topinambour 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5eb50fe8c98f7c0088d012be2121e40231ec8f26
4
- data.tar.gz: b1e33c5e616b8326bbc057452e42dd83c5f6208d
3
+ metadata.gz: b2c58d89e07204813f4116f6fb82d4ae0d3469f7
4
+ data.tar.gz: 1cc5cd49e4893852c8aef7336de6bcadfbf80218
5
5
  SHA512:
6
- metadata.gz: bf5d252a6ebf8b900ab6a21e484412a78845f57ef45b5bdc7f0b6f648d88e23481b1936b9a1831921bf43ceba045309ab5b343af4d462a84a7dd7c49703d0812
7
- data.tar.gz: 9059949fd99bf6160a88c452e566e9a01e3313af4651d37ca57316343fa93797c80dcc4e86bb863a1def017c30ea406e2b90c4ae16c2392a57becc6caf9ec843
6
+ metadata.gz: bc8234743007101b0b8a1edbb3e995c9afea0c898f3543306c37121b8019f192eaac418c14bea5e5932438b61d097f11d3d6b6e85a350e1e6142fea54a6a40fe
7
+ data.tar.gz: 7efda03dabd821aa1b82e87f9cdb5935c195f23f54c23f36a6b23168b82c2226abf4698e77709870ecc1aef8a9cf8355456b7085470bf98a2fd1d8a10c425977
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Topinambour
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/Topinambour.svg)](https://badge.fury.io/rb/Topinambour)
3
+ [![Gem Version](https://badge.fury.io/rb/topinambour.svg)](https://badge.fury.io/rb/topinambour)
4
+ [![Code Climate](https://codeclimate.com/github/cedlemo/topinambour/badges/gpa.svg)](https://codeclimate.com/github/cedlemo/topinambour)
4
5
 
5
- <a href="https://raw.github.com/cedlemo/germinal/master/screenshot1.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot1_prev.png" width="576" height="324" alt="Screenshot"></a>
6
+
7
+ <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot1.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot1_prev.png" width="576" height="324" alt="Screenshot"></a>
6
8
 
7
9
  Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the project [ruby-gnome2](https://github.com/ruby-gnome2/ruby-gnome2). I have written it for testing purpose, but Topinambour works well and I use it as my primary terminal emulator.
8
10
 
@@ -10,17 +12,17 @@ Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the pr
10
12
 
11
13
  * tabs supports
12
14
  * tabs can be reordered or selected through the preview mode ( `Shift + Ctrl + o` )
13
- <a href="https://raw.github.com/cedlemo/germinal/master/screenshot2.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot2_prev.png" width="576" height="324" alt="Screenshot"></a>
15
+ <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot2.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot2_prev.png" width="576" height="324" alt="Screenshot"></a>
14
16
 
15
17
  * Each tab can be named.
16
18
  * The configuration can be done via a Css file
17
19
  * Terminal colors can be changed on the fly and saved in the CSS configuration file
18
- <a href="https://raw.github.com/cedlemo/germinal/master/screenshot3.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot3_prev.png" width="576" height="324" alt="Screenshot"></a>
20
+ <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot3.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot3_prev.png" width="576" height="324" alt="Screenshot"></a>
19
21
  * Terminal font can be changed on the fly and saved in the CSS configuration file
20
- <a href="https://raw.github.com/cedlemo/germinal/master/screenshot4.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot4_prev.png" width="576" height="324" alt="Screenshot"></a>
22
+ <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot4.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot4_prev.png" width="576" height="324" alt="Screenshot"></a>
21
23
 
22
24
  * The Css file can be edited in a tab of Topinambour and saved. Each modifications are applied while you are writting them. (Use `Shift + Ctrl + w` to close the editor)
23
- <a href="https://raw.github.com/cedlemo/germinal/master/screenshot5.png"><img src="https://raw.github.com/cedlemo/germinal/master/screenshot5_prev.png" width="576" height="324" alt="Screenshot"></a>
25
+ <a href="https://raw.github.com/cedlemo/topinambour/master/screenshot5.png"><img src="https://raw.github.com/cedlemo/topinambour/master/screenshot5_prev.png" width="576" height="324" alt="Screenshot"></a>
24
26
  * Topinambour allows users to modify existing modules. For example if a user copy the css_editor.rb in the directory *~/.config/Topinambour/lib/css_editor.rb*, he should be able to modify it in order to fit its needs.
25
27
 
26
28
  ## TODO:
@@ -51,7 +53,7 @@ Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the pr
51
53
 
52
54
  ## User configuration
53
55
 
54
- It can be found in the file `$HOME/.config/Topinambour/germinal.css` (Be carefull by default Topinambour use fish as a default shell, if you want to use another one specify it in the germinal.css file)
56
+ It can be found in the file `$HOME/.config/Topinambour/topinambour.css` (Be carefull by default Topinambour use fish as a default shell, if you want to use another one specify it in the topinambour.css file)
55
57
 
56
58
  ```css
57
59
  *{
@@ -125,7 +127,7 @@ Each time you modify this configuration via the interface of Topinambour (termin
125
127
 
126
128
  FileUtils.mv(USR_CSS, "#{USR_CSS}_#{Time.new.strftime('%Y-%m-%d-%H-%M-%S')}.backup")
127
129
 
128
- Which means that the old file can be something like that : *germinal.css_2016-12-5-13-20.backup*.
130
+ Which means that the old file can be something like that : *topinambour.css_2016-12-5-13-20.backup*.
129
131
 
130
132
  ## Installation
131
133
 
@@ -156,8 +158,8 @@ the ruby gem binaries (for example).
156
158
 
157
159
  ##### Get the sources
158
160
 
159
- git clone https://github.com/cedlemo/germinal.git
160
- cd germinal/bin
161
+ git clone https://github.com/cedlemo/topinambour.git
162
+ cd topinambour/bin
161
163
 
162
164
  ##### Edit the files Topinambour and test
163
165
  The filenames correspond to their functionnalities.
data/bin/topinambour CHANGED
@@ -29,10 +29,10 @@ ROOT_PATH = File.expand_path("#{CURRENT_PATH}/..")
29
29
  LIB_PATH = "#{CURRENT_PATH}/../lib"
30
30
  DATA_PATH = "#{CURRENT_PATH}/../data"
31
31
  CONFIG_DIR = File.expand_path("#{ENV['HOME']}/.config/Topinambour")
32
- USR_CSS = "#{CONFIG_DIR}/germinal.css"
32
+ USR_CSS = "#{CONFIG_DIR}/topinambour.css"
33
33
  USR_LIB_PATH = "#{CONFIG_DIR}/lib"
34
- gresource_bin = "#{DATA_PATH}/germinal.gresource"
35
- gresource_xml = "#{DATA_PATH}/germinal.gresource.xml"
34
+ gresource_bin = "#{DATA_PATH}/topinambour.gresource"
35
+ gresource_xml = "#{DATA_PATH}/topinambour.gresource.xml"
36
36
 
37
37
  system("glib-compile-resources",
38
38
  "--target", gresource_bin,
@@ -55,8 +55,8 @@ terminal_chooser headerbar shortcuts window resize_message css_editor).each do |
55
55
  end
56
56
  end
57
57
 
58
- Gtk::IconTheme.default.add_resource_path("/com/github/cedlemo/germinal/icons")
58
+ Gtk::IconTheme.default.add_resource_path("/com/github/cedlemo/topinambour/icons")
59
59
 
60
- germinal = TopinambourApplication.new
60
+ topinambour = TopinambourApplication.new
61
61
 
62
- exit(germinal.run([$PROGRAM_NAME] + ARGV))
62
+ exit(topinambour.run([$PROGRAM_NAME] + ARGV))
File without changes
File without changes
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <gresources>
3
- <gresource prefix="/com/github/cedlemo/germinal">
3
+ <gresource prefix="/com/github/cedlemo/topinambour">
4
4
  <file preprocess="xml-stripblanks">window.ui</file>
5
5
  <file preprocess="xml-stripblanks">app-menu.ui</file>
6
6
  <file preprocess="xml-stripblanks">window-menu.ui</file>
7
7
  <file preprocess="xml-stripblanks">terminal-menu.ui</file>
8
- <file>germinal.css</file>
8
+ <file>topinambour.css</file>
9
9
  <file>application-exit-symbolic.svg</file>
10
10
  <file>color-select-symbolic.svg</file>
11
11
  <file>emblem-photos-symbolic.svg</file>
@@ -15,7 +15,7 @@
15
15
  <file>tab-new-symbolic.svg</file>
16
16
  <file>window-close-symbolic.svg</file>
17
17
  </gresource>
18
- <gresource prefix="/com/github/cedlemo/germinal/icons">
18
+ <gresource prefix="/com/github/cedlemo/topinambour/icons">
19
19
  <file>application-exit-symbolic.svg</file>
20
20
  <file>color-select-symbolic.svg</file>
21
21
  <file>emblem-photos-symbolic.svg</file>
data/lib/application.rb CHANGED
@@ -17,7 +17,7 @@
17
17
  class TopinambourApplication < Gtk::Application
18
18
  attr_reader :provider
19
19
  def initialize
20
- super("com.github.cedlemo.germinal", :non_unique)
20
+ super("com.github.cedlemo.topinambour", :non_unique)
21
21
 
22
22
  signal_connect "startup" do |application|
23
23
  load_css_config
@@ -55,14 +55,14 @@ class TopinambourApplication < Gtk::Application
55
55
  private
56
56
 
57
57
  def load_menu_ui_in(application)
58
- builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/germinal/app-menu.ui")
58
+ builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/app-menu.ui")
59
59
  app_menu = builder["appmenu"]
60
60
  application.app_menu = app_menu
61
61
  end
62
62
 
63
63
  def load_css_config
64
64
  @provider = Gtk::CssProvider.new
65
- default_css = Gio::Resources.lookup_data("/com/github/cedlemo/germinal/germinal.css", 0)
65
+ default_css = Gio::Resources.lookup_data("/com/github/cedlemo/topinambour/topinambour.css", 0)
66
66
  if File.exist?(USR_CSS)
67
67
  begin
68
68
  @provider.load(:path => USR_CSS)
data/lib/css_handler.rb CHANGED
@@ -1,47 +1,121 @@
1
+ require "sass"
2
+ require "gtk3" # to remove
3
+
1
4
  module CssHandler
2
- def css_file?(filename)
5
+ def self.css_file?(filename)
3
6
  filename =~ /^.*\.css$/ ? true : false
4
7
  end
5
-
6
- def scss_file?(filename)
8
+
9
+ def self.scss_file?(filename)
7
10
  filename =~ /^.*\.scss$/ ? true : false
8
11
  end
9
-
10
- def sass_file?(filename)
12
+
13
+ def self.sass_file?(filename)
11
14
  filename =~ /^.*\.sass$/ ? true : false
12
15
  end
13
16
 
14
- def to_css(filename)
17
+ def self.to_css(filename)
15
18
  content = File.open(filename, "r").read
16
19
  if css_file?(filename) || scss_file?(filename)
17
20
  Sass::Engine.new(content, :syntax => :scss).render
18
- else
21
+ elsif sass_file?(filename)
19
22
  Sass::Engine.new(content, :syntax => :sass).render
20
23
  else
21
24
  puts "Your theme file must be a css, scss or sass file"
22
25
  exit 1
23
26
  end
24
27
  end
25
-
26
- def color_property?(value)
28
+
29
+ def self.to_engine(filename)
30
+ content = File.open(filename, "r").read
31
+ if css_file?(filename) || scss_file?(filename)
32
+ Sass::Engine.new(content, :syntax => :scss)
33
+ elsif sass_file?(filename)
34
+ Sass::Engine.new(content, :syntax => :sass)
35
+ else
36
+ puts "Your theme file must be a css, scss or sass file"
37
+ exit 1
38
+ end
39
+ end
40
+
41
+ def self.color_property?(value)
42
+ parsed_color = nil
27
43
  begin
28
- Gdk::RGBA.parse(value)
44
+ parsed_color = Gdk::RGBA.parse(value)
29
45
  rescue
30
- false
46
+ parsed_color = nil
31
47
  end
32
- true
48
+ parsed_color ? true : false
33
49
  end
34
-
35
- def property_to_css_instructions(name, value)
36
- if value.class == String && color_property?(value)
50
+
51
+ def self.property_to_css_instructions(name, value)
52
+ if value.class == String && color_property?(value)
37
53
  "#{name}: #{value};\n"
38
- else value.class == String
54
+ elsif value.class == String
39
55
  "#{name}: \"#{value}\";\n"
40
56
  else
41
57
  "#{name}: #{value};\n"
42
- end
58
+ end
59
+ end
60
+
61
+ def self.props_with_name(tree, prop_name)
62
+ props = []
63
+ tree.children.each do |node|
64
+ node.each do |prop|
65
+ next if prop.class != Sass::Tree::PropNode
66
+ name = prop.name[0]
67
+ props << prop if name == prop_name
68
+ end
69
+ end
70
+ props
43
71
  end
44
72
 
45
- def get_global
73
+ def self.prop_position(prop)
74
+ source_range = prop.source_range
75
+ [source_range.start_pos, source_range.end_pos]
76
+ end
77
+
78
+ def self.property_defined?(tree, name)
79
+ tree.children.each do |node|
80
+ node.each do |prop|
81
+ next if prop.class != Sass::Tree::PropNode
82
+ return true if prop.name[0] == name
83
+ end
84
+ end
85
+ false
86
+ end
46
87
 
88
+ def self.modify_property(filename, tree, prop)
89
+ # Get the property line/pos via the tree
90
+ # modify the existing prop in the file
91
+ # create a temp file
92
+ # copy initial file and modify the part we want
93
+ # replace initial file with temp file
94
+ end
95
+
96
+ def self.append_property_in_universal_selector(filename, tree, prop)
97
+ # Get the universal selector line/pos via the tree
98
+ # append our property at the end of this selector
99
+ end
100
+
101
+ def self.selectors_with_name(tree, sel_name)
102
+ selectors = []
103
+ tree.children.each do |node|
104
+ next unless node.class == Sass::Tree::RuleNode
105
+ selectors << node
106
+ end
107
+ selectors
108
+ end
109
+
110
+ def self.update_css(filename, properties)
111
+ engine = to_engine(filename)
112
+ tree = engine.to_tree
113
+ properties.each do |prop|
114
+ if property_defined?(tree, prop[:name])
115
+ modify_property(filename, tree, prop)
116
+ else
117
+ append_property_in_universal_selector(filename, tree, prop)
118
+ end
119
+ end
120
+ end
47
121
  end
data/lib/headerbar.rb CHANGED
@@ -83,7 +83,7 @@ SECTOOLTIP
83
83
 
84
84
  def self.generate_open_menu_button(window)
85
85
  gen_icon_button("open-menu-symbolic", "Main Menu") do |button|
86
- builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/germinal/window-menu.ui")
86
+ builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/window-menu.ui")
87
87
  menu = Gtk::Menu.new(builder["winmenu"])
88
88
  menu.attach_to_widget(button)
89
89
  menu.children[0].signal_connect("activate") { window.show_css_editor }
data/lib/terminal.rb CHANGED
@@ -70,7 +70,7 @@ class TopinambourTerminal < Vte::Terminal
70
70
  end
71
71
  end
72
72
 
73
- builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/germinal/terminal-menu.ui")
73
+ builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/terminal-menu.ui")
74
74
  @menu = Gtk::Popover.new(self, builder["termmenu"])
75
75
 
76
76
  signal_connect "button-press-event" do |widget, event|
data/lib/window.rb CHANGED
@@ -26,7 +26,7 @@ class TopinambourWindow < Gtk::ApplicationWindow
26
26
 
27
27
  def initialize(application)
28
28
  super(:application => application)
29
- set_icon_from_file("#{DATA_PATH}/germinal-icon.png")
29
+ set_icon_from_file("#{DATA_PATH}/topinambour-icon.png")
30
30
  load_css_properties
31
31
  set_position(:center)
32
32
  create_header_bar
@@ -118,10 +118,10 @@ class TopinambourWindow < Gtk::ApplicationWindow
118
118
  "comments" => "Terminal Emulator based on the ruby bindings of Gtk3 and Vte3",
119
119
  "copyright" => "Copyright (C) 2015-2016 Cédric Le Moigne",
120
120
  "license" => "This program is licenced under the licence GPL-3.0 and later.",
121
- "logo" => Gdk::Pixbuf.new("#{DATA_PATH}/germinal-icon-128.png"),
121
+ "logo" => Gdk::Pixbuf.new("#{DATA_PATH}/topinambour-icon-128.png"),
122
122
  "program_name" => "Topinambour",
123
123
  "version" => "1.2.3",
124
- "website" => "https://github.com/cedlemo/germinal",
124
+ "website" => "https://github.com/cedlemo/topinambour",
125
125
  "website_label" => "Topinambour github repository"
126
126
  )
127
127
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topinambour
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cédric LE MOIGNE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-11 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vte3
@@ -86,17 +86,17 @@ files:
86
86
  - data/color-select-symbolic.svg
87
87
  - data/emblem-photos-symbolic.svg
88
88
  - data/font-select-symbolic.svg
89
- - data/germinal-icon-128.png
90
- - data/germinal-icon-16.png
91
- - data/germinal-icon-32.png
92
- - data/germinal-icon-64.png
93
- - data/germinal-icon.png
94
- - data/germinal.css
95
- - data/germinal.gresource.xml
96
89
  - data/pan-end-symbolic.svg
97
90
  - data/pan-start-symbolic.svg
98
91
  - data/tab-new-symbolic.svg
99
92
  - data/terminal-menu.ui
93
+ - data/topinambour-icon-128.png
94
+ - data/topinambour-icon-16.png
95
+ - data/topinambour-icon-32.png
96
+ - data/topinambour-icon-64.png
97
+ - data/topinambour-icon.png
98
+ - data/topinambour.css
99
+ - data/topinambour.gresource.xml
100
100
  - data/window-close-symbolic.svg
101
101
  - data/window-menu.ui
102
102
  - data/window.ui