visualruby 3.0.9 → 3.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f68ce5a6041fcc6a57dfaa680f001f3033768de0
4
- data.tar.gz: b86743fb4d3dc7395530d0933d5fe0f77f5bc355
3
+ metadata.gz: 46496d9e3a786ea8b5f5f1b6a89b813b6cd0d09a
4
+ data.tar.gz: d8876ec02fb0ed6e7b05f31ed7d0737bb3239e16
5
5
  SHA512:
6
- metadata.gz: ab61293fcd30e0980b50eae9e4335f1bba5331fee18dd01314f460ae9e813f79c156ade41bf837686a85e3c3dd15c7827d76cffb797aef38ef8bec40b45d1b2e
7
- data.tar.gz: 92cadfe248f6d67a3c5bc9eca4b7a06b36a4b7891d1b3c92b9af489bc17ae5d7e5962118d026f83ee56a9d151ce978115c84c8c8b8ae3a37b58d63f732cfa617
6
+ metadata.gz: 030b6c8b25c1312e5360076d557145e68805a0db37ec2a5f36f046485365decd9f6ab0f3611df3fb0c3e68cb1817812e2b1bd72f2f927219c7e999a4768095b1
7
+ data.tar.gz: 7963567437104f66bd96f322efcf05d1c3c2047c9cc080c3fd81d51758552a74df5aa687d74726baeea0098278c012665dc07ded4825a6de531d7e9d05b8fa1f
data/.vr_settings.yaml CHANGED
@@ -1,29 +1,19 @@
1
1
  --- !ruby/object:VR_ENV
2
- width: 1364
3
- height: 691
4
- panel_pos: 270
5
- run_command_line: ruby vr
2
+ width: 1261
3
+ height: 720
4
+ panel_pos: 360
5
+ run_command_line: ruby main.rb
6
6
  open_files:
7
- - "/home/eric/vrp/vr3/vr.gemspec"
8
- - "/home/eric/vrp/vr3/bin/main/VR_Main.rb"
9
- - "/home/eric/vrp/vr3/bin/main/VR_Tools.rb"
10
- - "/home/eric/vrp/vr3/bin/main/VR_ENV.rb"
11
- - "/home/eric/vrp/vr3/bin/main/OpenProject.rb"
12
- - "/home/eric/vrp/vr3/bin/main/VR_File_Tree.rb"
13
- - "/home/eric/vrp/vr3/examples/filetreeview/bin/ProjectTree.rb"
14
- - "/home/eric/vrp/vr3/examples/listview/bin/SongListViewGUI.rb"
15
- - "/home/eric/vrp/vr3/vrlib/lib/treeview/columns/CellRendererObject.rb"
16
7
  - "/home/eric/vrp/vr3/bin/editor/VR_Document.rb"
8
+ - "/home/eric/vrp/vr3/bin/main/VR_Main.rb"
9
+ - "/home/eric/vrp/vr3/vrlib/lib/treeview/FileTreeView.rb"
10
+ - "/home/eric/vrp/vr3/vr.gemspec"
17
11
  open_folders:
18
12
  - "/home/eric/vrp/vr3"
19
13
  - "/home/eric/vrp/vr3/bin"
20
14
  - "/home/eric/vrp/vr3/bin/main"
21
- - "/home/eric/vrp/vr3/vrlib"
22
- - "/home/eric/vrp/vr3/vrlib/lib"
23
- current_file: "/home/eric/vrp/vr3/bin/editor/VR_Document.rb"
24
- rdoc_command_line: rdoc -x README -x /*.glade -x /*.yaml -x /*.gemspec -x /*.css
15
+ current_file: "/home/eric/vrp/vr3/vr.gemspec"
16
+ rdoc_command_line: rdoc -x README
25
17
  vr_yaml_file: ".vr_settings.yaml"
26
- notebook_panel_position: 474
27
- current_line: 132
28
- builder: !ruby/object:Gtk::Builder {}
29
- top_level_window: false
18
+ notebook_panel_position: 400
19
+ current_line: 21
@@ -145,29 +145,6 @@ class VR_Document < GtkSource::View
145
145
  apply_tag_to_line(line-1, @hilight, nil)
146
146
  end
147
147
 
148
- def indent(spaces)
149
- return unless buffer.has_selection?
150
- s,e = get_selected_lines()
151
- (s..e).each do |i|
152
- iter = buffer.get_iter_at(:line => i)
153
- buffer.insert(iter, " " * spaces)
154
- end
155
- end
156
-
157
- def unindent(spaces)
158
- return unless buffer.has_selection?
159
- s,e = get_selected_lines()
160
- (s..e).each do |i|
161
- iter, iter_end = get_line_iters(i)
162
- if iter_end.offset >= iter.offset + 2
163
- iter_end.offset = iter.offset + 2
164
- t = buffer.get_text(iter, iter_end, false)
165
- buffer.delete(iter, iter_end)
166
- buffer.insert(iter,t.lstrip)
167
- end
168
- end
169
- end
170
-
171
148
  def comment()
172
149
  return unless buffer.has_selection?
173
150
  s,e = get_selected_lines()
@@ -59,8 +59,9 @@ class VR_Tabs < Gtk::Notebook
59
59
  end
60
60
  end
61
61
 
62
- def load_tab(full_path_file = Dir.pwd + "/Untitled")
63
- return if switch_to(full_path_file)
62
+ def load_tab(full_path_file = Dir.pwd + "/Untitled")
63
+ full_path_file = Dir.pwd + "/Untitled" if full_path_file == ""
64
+ return if switch_to(full_path_file)
64
65
  box = Gtk::EventBox.new
65
66
  tab = Gtk::Box.new(:horizontal)
66
67
  img = Gtk::Image.new(:pixbuf => @pix_close)
@@ -79,7 +80,7 @@ class VR_Tabs < Gtk::Notebook
79
80
  self.remove_page(0)
80
81
  end
81
82
  child.show_all #needed
82
- append_page(child, tab)
83
+ append_page(child, tab)
83
84
  self.page = self.n_pages - 1
84
85
  @docs[self.page] = text
85
86
  end
@@ -113,7 +114,7 @@ class VR_Tabs < Gtk::Notebook
113
114
  end
114
115
 
115
116
  def open_file_names(ar)
116
- ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
117
+ ar.each { |fn| load_tab(fn) if File.file?(fn) and fn.include? Dir.pwd}
117
118
  load_tab() if @docs.empty?
118
119
  end
119
120
 
@@ -3,8 +3,6 @@ class NewProjectGUI
3
3
 
4
4
  include GladeGUI
5
5
 
6
- attr_accessor :my_var
7
-
8
6
  def initialize(parent)
9
7
  @parent = parent
10
8
  @projects_home = $VR_ENV_GLOBAL.projects_home + "/"
@@ -13,21 +11,14 @@ class NewProjectGUI
13
11
  def buttonCreate__clicked(*args)
14
12
  fn = @builder["entryFolderName"].text
15
13
  fn = fn.gsub(/[^\w\.\/]/, '_')
16
- path = File.join($VR_ENV_GLOBAL.projects_home + "/" + fn)
17
- if File.directory?(path)
18
- alert "The folder <b>" + path + "</b> is already ok disk. You can open it using the <b>Open Project</b> button.",
19
- :headline=> "Project Already Exists", :parent => self, :width => 500
20
- else
14
+ path = File.join($VR_ENV_GLOBAL.projects_home, fn)
15
+ return if fn.length < 2
16
+ unless File.directory?(path)
21
17
  FileUtils.mkpath path
22
18
  VR_Tools.copy_skeleton_project(path)
23
- @parent.proj_path = path
24
- @builder["window1"].destroy
25
19
  end
26
- end
27
-
28
- def buttonCancel__clicked(*args)
29
- @my_var = "Hello"
30
- # @builder["window1"].destroy
20
+ @parent.proj_path = path
21
+ @builder["window1"].destroy
31
22
  end
32
23
 
33
24
  end
@@ -114,7 +114,8 @@ class VR_File_Tree < VR::FileTreeView
114
114
  end
115
115
  end
116
116
 
117
- def self__key_press_event(view, evt)
117
+ def self__key_press_event(view, evt)
118
+ alert evt.keyval.to_s
118
119
  return unless evt.keyval == 65535 #delete
119
120
  return unless file_name = get_selected_path()
120
121
  return unless alert("Delete: <b>" + File.basename(file_name) + "</b> ?" , :button_yes => "Delete", :button_no=>"Cancel", :parent=>self, :headline => "Delete FIle?")
data/bin/main/VR_Main.rb CHANGED
@@ -11,14 +11,21 @@ class VR_Main
11
11
  end
12
12
 
13
13
  def before_show
14
- # there must be a visualruby directory:
15
- menuInstallExamples__activate if not File.directory?(File.join(ENV["HOME"],"","visualruby", "examples","alert_box"))
14
+
15
+ # there must be a visualruby directory:
16
+ required_project = File.join(ENV["HOME"],"","visualruby", "examples","alert_box")
17
+ menuInstallExamples__activate if not File.directory?(required_project)
18
+
16
19
  # load global settings (requires /home/visuaruby folder exists
17
20
  $VR_ENV_GLOBAL = VR::load_yaml(:class => VR_ENV_GLOBAL, :file_name => VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
21
+
18
22
  # try to open right project
19
-
20
- if not project_valid?(@proj_path)
21
- @proj_path = $VR_ENV_GLOBAL.default_project if project_valid?($VR_ENV_GLOBAL.default_project)
23
+ if not project_valid?(@proj_path)
24
+ if not project_valid?($VR_ENV_GLOBAL.default_project)
25
+ $VR_ENV_GLOBAL.default_project = required_project
26
+ VR::save_yaml($VR_ENV_GLOBAL)
27
+ end
28
+ @proj_path = $VR_ENV_GLOBAL.default_project
22
29
  end
23
30
 
24
31
  @file_tree = VR_File_Tree.new(self, File.expand_path(File.dirname(__FILE__) + "/../../img"))
@@ -48,7 +55,7 @@ class VR_Main
48
55
  Gtk.main_quit
49
56
 
50
57
  unless project_valid?(@proj_path)
51
- toolOpenFolder__clicked
58
+ toolOpenFolder__clicked # should never gets here.
52
59
  end
53
60
 
54
61
  if project_valid?(@proj_path)
@@ -100,13 +107,6 @@ class VR_Main
100
107
  when 2 then @remote_gem_tree.refresh(false) #false = don't force refresh
101
108
  end
102
109
  end
103
-
104
- def window1_key_press(win, key)
105
- case x = key.keyval
106
- when 65474 then toolRun__clicked # F5
107
- # when 115 then toolSave__clicked # Ctrl-S
108
- end
109
- end
110
110
 
111
111
  def menuCloseAll__activate(*a)
112
112
  @tabs.try_to_save_all(:close=>true)
@@ -185,16 +185,20 @@ class VR_Main
185
185
  end
186
186
 
187
187
  def toolIndent__clicked(*a)
188
- # @tabs.docs[@tabs.page].indent_selected_lines()
189
- # evt = Gdk::EventKey.new(:key_press)
190
- # evt.keyval = Gdk::Keyval::GDK_6
191
- # evt.put
192
- @tabs.docs[@tabs.page].indent($VR_ENV_GLOBAL.tab_spaces)
188
+ press_key(65289) #tab
193
189
  end
194
190
 
195
- def toolUnIndent__clicked(*a)
196
- @tabs.docs[@tabs.page].unindent($VR_ENV_GLOBAL.tab_spaces)
191
+ def toolUnIndent__clicked(*a)
192
+ press_key(65056, :shift_mask) # shift+tab
197
193
  end
194
+
195
+ def press_key(keyval, mask = nil)
196
+ evt = Gdk::EventKey.new(:key_press)
197
+ evt.state = mask if mask
198
+ evt.keyval = keyval
199
+ @tabs.docs[@tabs.page].signal_emit(:key_press_event, evt)
200
+ end
201
+
198
202
 
199
203
  def toolComment__clicked(*a)
200
204
  @tabs.docs[@tabs.page].comment()
@@ -265,7 +269,7 @@ class VR_Main
265
269
  @tabs.docs[@tabs.page].replace(@builder[:entryReplace].text)
266
270
  end
267
271
 
268
- def entryFind_key_press(me, evt)
272
+ def entryFind__key_press_event(me, evt)
269
273
  return if evt.keyval != 65293 #enter key
270
274
  buttonFind_clicked
271
275
  end
@@ -21,6 +21,7 @@
21
21
  <property name="margin_top">20</property>
22
22
  <property name="margin_bottom">20</property>
23
23
  <property name="orientation">vertical</property>
24
+ <property name="spacing">10</property>
24
25
  <child>
25
26
  <object class="GtkLabel" id="label1">
26
27
  <property name="visible">True</property>
@@ -38,7 +39,11 @@
38
39
  <object class="GtkLabel" id="label2">
39
40
  <property name="visible">True</property>
40
41
  <property name="can_focus">False</property>
41
- <property name="label" translatable="yes">Enter the name for your new project. A directory will be created under your /home/visualruby directory with that name. Use only letters and underscores.
42
+ <property name="label" translatable="yes">Enter the path for your new project. If the directory doesn't exist, it will be created.
43
+
44
+ If the directory already exists, it will be opened and marked as a visualruby project so you can open it in the future.
45
+
46
+ Use only letters and underscores.
42
47
 
43
48
  You are free to move the project later.</property>
44
49
  <property name="wrap">True</property>
@@ -95,10 +100,11 @@ You are free to move the project later.</property>
95
100
  <property name="can_focus">False</property>
96
101
  <property name="margin_top">10</property>
97
102
  <property name="margin_bottom">10</property>
98
- <property name="layout_style">spread</property>
103
+ <property name="spacing">10</property>
104
+ <property name="layout_style">end</property>
99
105
  <child>
100
- <object class="GtkButton" id="buttonCreate">
101
- <property name="label" translatable="yes">Create Project</property>
106
+ <object class="GtkButton" id="buttonCancel">
107
+ <property name="label" translatable="yes">Cancel</property>
102
108
  <property name="use_action_appearance">False</property>
103
109
  <property name="visible">True</property>
104
110
  <property name="can_focus">True</property>
@@ -111,8 +117,8 @@ You are free to move the project later.</property>
111
117
  </packing>
112
118
  </child>
113
119
  <child>
114
- <object class="GtkButton" id="buttonCancel">
115
- <property name="label" translatable="yes">Cancel</property>
120
+ <object class="GtkButton" id="buttonCreate">
121
+ <property name="label" translatable="yes">Create Project</property>
116
122
  <property name="use_action_appearance">False</property>
117
123
  <property name="visible">True</property>
118
124
  <property name="can_focus">True</property>
@@ -436,7 +436,6 @@
436
436
  <property name="invisible_char">●</property>
437
437
  <property name="primary_icon_activatable">False</property>
438
438
  <property name="secondary_icon_activatable">False</property>
439
- <signal name="key-press-event" handler="entryFind_key_press" swapped="no"/>
440
439
  </object>
441
440
  <packing>
442
441
  <property name="left_attach">0</property>
@@ -90,7 +90,7 @@
90
90
 
91
91
  module GladeGUI
92
92
 
93
- attr_accessor :builder
93
+ attr_accessor :builder
94
94
 
95
95
  ##
96
96
  #
@@ -126,20 +126,23 @@ end
126
126
  #
127
127
  # widget = @builder["name"]
128
128
  #
129
- # Normally, you should give your widgets names of instance variables: i.e. "MyClass.var"
130
- # so they can be autoloaded using the set_glade_all() method.
129
+ # Normally, you should give your widgets names of instance variables: i.e. @email
130
+ # so they can be autoloaded using the set_glade_all() method. For example,
131
+ # the value of the @email vaiable would be loaded into a Gtk:Entry named "email"
132
+ # in your glade form. It saves you from having to do this:
133
+ #
134
+ # @builder[:email] = @email
131
135
  #
132
136
  # You can also pass a reference to a parent class that also includes GladeGUI.
133
137
  # Then the child window will run simultaniously with the parent.
134
138
  #
135
139
 
136
- def load_glade()
140
+ def load_glade()
137
141
  caller__FILE__ = my_class_file_path()
138
- file_name = File.split(caller__FILE__)[0] + '/glade/' + class_name(self) + ".glade"
142
+ file_name = File.join(File.split(caller__FILE__)[0] , "glade", class_name(self) + ".glade")
139
143
  @builder = Gtk::Builder.new
140
144
  @builder << file_name
141
145
  @builder.connect_signals{ |handle| method(handle) }
142
- # parse_signals() should be called after before_show()
143
146
  end
144
147
 
145
148
  def class_name(obj) # :nodoc:
@@ -154,9 +157,9 @@ end
154
157
  #
155
158
  # Remember that it will enforce the naming convention: gladename__signal. No arguments.
156
159
 
157
- def parse_signals()
160
+ def parse_signals()
158
161
  meths = self.class.instance_methods()
159
- meths.each do |meth|
162
+ meths.each do |meth|
160
163
  meth = meth.to_s #bug fix ruby 1.9 gives stmbol
161
164
  glade_name, signal_name = *(meth.split("__"))
162
165
  next if (signal_name.to_s == "" or glade_name.to_s == "") #covers nil
@@ -169,10 +172,24 @@ end
169
172
  end
170
173
  end
171
174
  obj = glade_name == "self" ? self : self.instance_variable_get("@" + glade_name)
172
- obj ||= eval(glade_name) if respond_to?(glade_name) and method(glade_name.to_sym).arity == 0 # no arguments!
173
- obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) } if obj.respond_to?("signal_connect")
175
+ obj ||= eval(glade_name) if respond_to?(glade_name) and method(glade_name.to_sym).arity == 0 # no arguments!
176
+ if obj.respond_to?("signal_connect")
177
+ obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) }
178
+ end
174
179
  end
175
- end
180
+ end
181
+
182
+ # parses instance variables added in before_show
183
+ # def parse_instance_signals(dig = true)
184
+ # instance_variables.each do |var|
185
+ # obj = instance_variable_get(var)
186
+ # if obj.respond_to?(:load_glade)
187
+ # obj.load_glade
188
+ # obj.parse_signals # dig one level
189
+ # obj.parse_instance_signals(false) if dig # never ending loop if instance vaiables are in 2 objects
190
+ # end
191
+ # end
192
+ # end
176
193
 
177
194
  # This method is the most useful method to populate a glade form. It will
178
195
  # populate from active_record fields and instance variables. It will simply
@@ -404,6 +421,7 @@ end
404
421
  end
405
422
  return true
406
423
  end
424
+
407
425
 
408
426
  end
409
427
 
@@ -3,7 +3,7 @@ module VR
3
3
  def self.load_yaml(flags)
4
4
  me = nil
5
5
  if File.file?(flags[:file_name])
6
- me = YAML.load(File.open(flags[:file_name]).read)
6
+ me = YAML.load(File.open(flags[:file_name]).read)
7
7
  elsif flags[:class]
8
8
  me = flags[:class].new()
9
9
  end
@@ -65,8 +65,8 @@ module VR
65
65
 
66
66
  def open_folders(folder_paths)
67
67
  model.each do |model, path, iter|
68
- if folder_paths.include?(iter[id(:path)])
69
- expand_row(path, false)
68
+ if folder_paths.include?(iter[id(:path)])
69
+ self__row_expanded(self, iter, path)
70
70
  end
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visualruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.9
4
+ version: 3.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Cunningham
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir:
10
10
  - "."
11
11
  cert_chain: []
12
- date: 2016-06-13 00:00:00.000000000 Z
12
+ date: 2016-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk3