arcadia 0.9.2 → 0.9.3

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.
@@ -74,7 +74,6 @@ end
74
74
 
75
75
 
76
76
  class FilesHistrory < ArcadiaExt
77
- include Autils
78
77
  attr_reader :htree
79
78
 
80
79
  def sync_on
@@ -115,7 +114,7 @@ class FilesHistrory < ArcadiaExt
115
114
  @cb_sync.command(do_check)
116
115
 
117
116
  do_select_item = proc{|_self|
118
- _selected = self.selected
117
+ _selected = @htree.selected
119
118
  _dir, _file = _selected.sub("%%%",":").split('@@@')
120
119
  if _file
121
120
  _file = File.expand_path( _file , _dir )
@@ -147,7 +146,8 @@ class FilesHistrory < ArcadiaExt
147
146
  @htree.extend(TkScrollableWidget).show(0,26)
148
147
 
149
148
  do_double_click = proc{
150
- _selected = @htree.selection_get[0]
149
+ #_selected = @htree.selection_get[0]
150
+ _selected = @htree.selected
151
151
  _dir, _file = _selected.sub("%%%",":").split('@@@')
152
152
  if _dir && _file.nil? && File.ftype(node2file(_dir)) == 'directory'
153
153
  _file = Tk.getOpenFile('initialdir'=>node2file(_dir))
@@ -215,31 +215,30 @@ class FilesHistrory < ArcadiaExt
215
215
  end
216
216
 
217
217
 
218
- def selected
219
- if @htree.selection_get[0]
220
- if @htree.selection_get[0].length >0
221
- _selected = ""
222
- if String.method_defined?(:lines)
223
- selection_lines = @htree.selection_get[0].lines
224
- else
225
- selection_lines = @htree.selection_get[0].split("\n")
226
- end
227
- selection_lines.each{|_block|
228
- _selected = _selected + _block.to_s + "\s"
229
- }
230
- _selected = _selected.strip
231
- else
232
- _selected = @htree.selection_get[0]
233
- end
234
- end
235
- return _selected
236
- end
237
-
218
+ # def selected
219
+ # if @htree.selection_get[0]
220
+ # if @htree.selection_get[0].length >0
221
+ # _selected = ""
222
+ # if String.method_defined?(:lines)
223
+ # selection_lines = @htree.selection_get[0].lines
224
+ # else
225
+ # selection_lines = @htree.selection_get[0].split("\n")
226
+ # end
227
+ # selection_lines.each{|_block|
228
+ # _selected = _selected + _block.to_s + "\s"
229
+ # }
230
+ # _selected = _selected.strip
231
+ # else
232
+ # _selected = @htree.selection_get[0]
233
+ # end
234
+ # end
235
+ # return _selected
236
+ # end
238
237
 
239
238
  def select_file_without_event(_file)
240
239
  _d, _f = File.split(File.expand_path(_file))
241
- _d = _d.downcase if is_windows?
242
- _f = _f.downcase if is_windows?
240
+ _d = _d.downcase if Arcadia.is_windows?
241
+ _f = _f.downcase if Arcadia.is_windows?
243
242
  _file_node_rif = _d+'@@@'+_f
244
243
  if @htree.exist?(_file_node_rif)
245
244
  _proc = @htree.cget('selectcommand')
@@ -306,8 +305,8 @@ class FilesHistrory < ArcadiaExt
306
305
  _file = _line.split(';')[0]
307
306
  if FileTest::exist?(_file)
308
307
  dir,fil =File.split(File.expand_path(_file))
309
- dir = dir.downcase if is_windows?
310
- fil = fil.downcase if is_windows?
308
+ dir = dir.downcase if Arcadia.is_windows?
309
+ fil = fil.downcase if Arcadia.is_windows?
311
310
  file_dir[dir] = Array.new if file_dir[dir] == nil
312
311
  file_dir[dir] << fil if !file_dir[dir].include?(fil)
313
312
  end
@@ -356,7 +355,7 @@ class FilesHistrory < ArcadiaExt
356
355
  :label=>'Find in files...',
357
356
  :hidemargin => false,
358
357
  :command=> proc{
359
- _target = self.selected
358
+ _target = @htree.selected
360
359
  _dir, _file = _target.sub("%%%",":").split('@@@')
361
360
  if _dir
362
361
  Arcadia.process_event(SearchInFilesEvent.new(self,'dir'=>_dir))
@@ -369,7 +368,7 @@ class FilesHistrory < ArcadiaExt
369
368
  :label=>'Act in files...',
370
369
  :hidemargin => false,
371
370
  :command=> proc{
372
- _target = self.selected
371
+ _target = @htree.selected
373
372
  _dir, _file = _target.sub("%%%",":").split('@@@')
374
373
  if _dir
375
374
  Arcadia.process_event(AckInFilesEvent.new(self,'dir'=>_dir))
@@ -400,8 +399,8 @@ class FilesHistrory < ArcadiaExt
400
399
  #Arcadia.new_error_msg(self, "add_to_tree _file=#{_file}")
401
400
  #Arcadia.new_error_msg(self, "add_to_tree _d=#{_d}")
402
401
  #Arcadia.new_error_msg(self, "add_to_tree _f=#{_f}")
403
- _d = _d.downcase if is_windows?
404
- _f = _f.downcase if is_windows?
402
+ _d = _d.downcase if Arcadia.is_windows?
403
+ _f = _f.downcase if Arcadia.is_windows?
405
404
  #_foreground = conf('color.foreground')
406
405
  node = root.dir(_d)
407
406
 
@@ -23,92 +23,92 @@ class OutputView
23
23
  #relief 'groove'
24
24
  pack('side' =>'top', 'anchor'=>'n',:padx=>0, :pady=>0)
25
25
  }
26
-
26
+
27
27
  @text = TkArcadiaText.new(right_frame,
28
- {'wrap'=> 'none'}.update(Arcadia.style('edit'))
28
+ {'wrap'=> 'none'}.update(Arcadia.style('edit'))
29
29
  )
30
30
  @text.extend(TkScrollableWidget).show
31
31
 
32
32
  @text.tag_configure('simple_msg',
33
33
  # 'background' => '#d9d994',
34
- 'borderwidth'=>1,
35
- 'relief'=> 'flat'
34
+ 'borderwidth'=>1,
35
+ 'relief'=> 'flat'
36
36
  )
37
37
  @text.tag_configure('debug_msg',
38
38
  # 'background' => '#f6c9f6',
39
39
  # 'foreground' => '#000000',
40
- 'borderwidth'=>1,
41
- 'relief'=> 'flat'
40
+ 'borderwidth'=>1,
41
+ 'relief'=> 'flat'
42
42
  )
43
43
  @text.tag_configure('error_msg',
44
- # 'background' => '#f6c9f6',
45
- 'foreground' => Arcadia.conf('hightlight.string.foreground'),
46
- 'borderwidth'=>1,
47
- 'relief'=> 'flat'
44
+ # 'background' => '#f6c9f6',
45
+ 'foreground' => Arcadia.conf('hightlight.string.foreground'),
46
+ 'borderwidth'=>1,
47
+ 'relief'=> 'flat'
48
48
  )
49
49
  @text.tag_configure('bord_msg',
50
- #'foreground' => '#b9b8b9'
51
- 'foreground' => Arcadia.conf('hightlight.comment.foreground')
50
+ #'foreground' => '#b9b8b9'
51
+ 'foreground' => Arcadia.conf('hightlight.comment.foreground')
52
52
  )
53
- @text.tag_configure('sel',
54
- 'background'=>Arcadia.conf('hightlight.sel.background'),
55
- 'foreground'=>Arcadia.conf('hightlight.sel.foreground')
53
+ @text.tag_configure('sel',
54
+ 'background'=>Arcadia.conf('hightlight.sel.background'),
55
+ 'foreground'=>Arcadia.conf('hightlight.sel.foreground')
56
56
  )
57
57
  pop_up_menu
58
58
  end
59
59
 
60
60
  def pop_up_menu
61
61
  @pop_up = TkMenu.new(
62
- :parent=>@text,
63
- :tearoff=>0,
64
- :title => 'Menu'
62
+ :parent=>@text,
63
+ :tearoff=>0,
64
+ :title => 'Menu'
65
65
  )
66
66
  @pop_up.extend(TkAutoPostMenu)
67
67
  @pop_up.configure(Arcadia.style('menu'))
68
-
68
+
69
69
  @pop_up.insert('end',
70
- :command,
71
- :state=>'disabled',
72
- :label=>'Output',
73
- :background=>Arcadia.conf('titlelabel.background'),
74
- :font => "#{Arcadia.conf('menu.font')} bold",
75
- :hidemargin => true
70
+ :command,
71
+ :state=>'disabled',
72
+ :label=>'Output',
73
+ :background=>Arcadia.conf('titlelabel.background'),
74
+ :font => "#{Arcadia.conf('menu.font')} bold",
75
+ :hidemargin => true
76
76
  )
77
77
 
78
-
78
+
79
79
  #Arcadia.instance.main_menu.update_style(@pop_up)
80
80
  @pop_up.insert('end',
81
- :command,
82
- :label=>'Save',
83
- :hidemargin => false,
84
- :command=> proc{save_as}
81
+ :command,
82
+ :label=>'Save',
83
+ :hidemargin => false,
84
+ :command=> proc{save_as}
85
85
  )
86
86
 
87
87
 
88
88
 
89
89
  @pop_up.insert('end',
90
- :command,
91
- :label=>'Set wrap',
92
- :hidemargin => false,
93
- :command=> proc{@text.configure('wrap'=>'word');@text.hide_h_scroll}
90
+ :command,
91
+ :label=>'Set wrap',
92
+ :hidemargin => false,
93
+ :command=> proc{@text.configure('wrap'=>'word');@text.hide_h_scroll}
94
94
  )
95
95
 
96
96
  @pop_up.insert('end',
97
- :command,
98
- :label=>'Set no wrap',
99
- :hidemargin => false,
100
- :command=> proc{@text.configure('wrap'=>'none');@text.show_h_scroll}
97
+ :command,
98
+ :label=>'Set no wrap',
99
+ :hidemargin => false,
100
+ :command=> proc{@text.configure('wrap'=>'none');@text.show_h_scroll}
101
101
  )
102
102
 
103
103
 
104
104
 
105
-
105
+
106
106
  @text.bind("Button-3",
107
- proc{|x,y|
108
- _x = TkWinfo.pointerx(@text)
109
- _y = TkWinfo.pointery(@text)
110
- @pop_up.popup(_x,_y)
111
- },
107
+ proc{|x,y|
108
+ _x = TkWinfo.pointerx(@text)
109
+ _y = TkWinfo.pointery(@text)
110
+ @pop_up.popup(_x,_y)
111
+ },
112
112
  "%x %y")
113
113
  end
114
114
 
@@ -135,79 +135,81 @@ class OutputView
135
135
  end
136
136
  end
137
137
 
138
-
138
+
139
139
  end
140
140
 
141
141
  class Output < ArcadiaExt
142
142
  attr_reader :main_frame
143
143
  MARKSUF='mark-'
144
- def on_before_build(_event)
144
+ def on_before_build(_event)
145
145
  #ArcadiaContractListener.new(self, MsgContract, :do_msg_event)
146
146
  Arcadia.attach_listener(self, MsgEvent)
147
147
  #_frame = @arcadia.layout.register_panel('_rome_',@name, 'Output')
148
148
  @main_frame = OutputView.new(self)
149
149
  @run_threads = Array.new
150
- end
150
+ end
151
151
 
152
152
 
153
153
  def on_after_build(_event)
154
154
  self.frame.show
155
155
  end
156
156
 
157
- def format_time(_time)
158
- _time.strftime("at %a %d-%b-%Y %H:%M:%S")
159
- end
160
-
161
- def on_msg(_event)
162
- self.frame.show
163
- if _event.mark
164
- _mark_index = _event.mark.sub(MARKSUF,'');
165
- _index_begin = "#{_mark_index} + 1 lines + 1 chars"
166
- #_index_begin = "#{@main_frame.text.index(_event.mark)} + 1 lines + 1 chars"
167
- # _b = Tk::BWidget::Button.new(@main_frame.text,
168
- # 'helptext'=>Time.now.strftime("-> %d-%b-%Y %H:%M:%S"),
169
- # 'background'=>Arcadia.style('edit')['background'],
170
- # 'borderwidth'=>0,
171
- # 'image'=> TkPhotoImage.new('data' => ITEM_LOG_GIF),
172
- # 'relief'=>'flat')
173
- # TkTextWindow.new(@main_frame.text, _index_begin, 'window'=> _b)
174
- # TkTextImage.new(@main_frame.text, _index_begin, 'padx'=>0, 'pady'=>0, 'image'=> TkPhotoImage.new('data' => ITEM_LOG_GIF))
175
- else
176
- @main_frame.text.insert("end","\n")
177
- _index_begin = @main_frame.text.index('end')
178
- TkTextImage.new(@main_frame.text, _index_begin, 'padx'=>0, 'pady'=>0, 'image'=> TkPhotoImage.new('data' => ITEM_START_LOG_GIF))
179
- @main_frame.text.insert("end"," +--- #{format_time(_event.time)} ---+\n", 'bord_msg')
180
- end
181
- if _event.append
182
- _index_begin = "#{@main_frame.text.index(_index_begin)} - 2 lines lineend"
183
- _txt = _event.msg
184
- elsif _event.msg[-1] == "\n"
185
- _txt = _event.msg
186
- else
187
- _txt = "#{_event.msg}\n"
188
- end
189
- if _event.level == 'error'
190
- TkTextImage.new(@main_frame.text, _index_begin, 'padx'=>0, 'pady'=>0, 'image'=> TkPhotoImage.new('data' => ERROR_9X9_GIF))
191
- end
192
- @main_frame.text.insert(_index_begin,_txt, "#{_event.level}_msg")
193
- _index_end = @main_frame.text.index('end')
194
- if ['debug','error'].include?(_event.level)
195
- parse_debug(_index_begin.split('.')[0].to_i, _index_end.split('.')[0].to_i)
196
- end
197
- @main_frame.text.see(_index_end)
198
- @main_frame.text.mark_unset(_event.mark)
199
- _event.mark="#{MARKSUF}#{_index_end}"
200
- @main_frame.text.mark_set(_event.mark, "#{_index_end} - 1 lines -1 chars")
201
- # if _event.instance_of?(MsgRunEvent)
202
- # _b = TkButton.new(@main_frame.text,
203
- # 'command'=>proc{_event.abort_action.call;_b.destroy},
204
- # 'image'=> TkPhotoImage.new('data' => CLOSE_GIF),
205
- # 'relief'=>'groove')
206
- # TkTextWindow.new(@main_frame.text, 'end', 'window'=> _b)
207
- # end
208
- end
209
-
210
- def parse_debug(_from_row=0, _to_row=-1)
157
+ def format_time(_time)
158
+ _time.strftime("at %a %d-%b-%Y %H:%M:%S")
159
+ end
160
+
161
+ def on_msg(_event)
162
+ self.frame.show
163
+ if _event.mark
164
+ _mark_index = _event.mark.sub(MARKSUF,'');
165
+ _index_begin = "#{_mark_index} + 1 lines + 1 chars"
166
+ #_index_begin = "#{@main_frame.text.index(_event.mark)} + 1 lines + 1 chars"
167
+ # _b = Tk::BWidget::Button.new(@main_frame.text,
168
+ # 'helptext'=>Time.now.strftime("-> %d-%b-%Y %H:%M:%S"),
169
+ # 'background'=>Arcadia.style('edit')['background'],
170
+ # 'borderwidth'=>0,
171
+ # 'image'=> TkPhotoImage.new('data' => ITEM_LOG_GIF),
172
+ # 'relief'=>'flat')
173
+ # TkTextWindow.new(@main_frame.text, _index_begin, 'window'=> _b)
174
+ # TkTextImage.new(@main_frame.text, _index_begin, 'padx'=>0, 'pady'=>0, 'image'=> TkPhotoImage.new('data' => ITEM_LOG_GIF))
175
+ else
176
+ @main_frame.text.insert("end","\n")
177
+ _index_begin = @main_frame.text.index('end')
178
+ TkTextImage.new(@main_frame.text, _index_begin, 'padx'=>0, 'pady'=>0, 'image'=> TkPhotoImage.new('data' => ITEM_START_LOG_GIF))
179
+ @main_frame.text.insert("end"," +--- #{format_time(_event.time)} ---+\n", 'bord_msg')
180
+ end
181
+ if _event.append
182
+ _index_begin = "#{@main_frame.text.index(_index_begin)} - 2 lines lineend"
183
+ _txt = _event.msg
184
+ elsif _event.msg[-1] == "\n"
185
+ _txt = _event.msg
186
+ else
187
+ _txt = "#{_event.msg}\n"
188
+ end
189
+ # if _event.level == 'error'
190
+ # TkTextImage.new(@main_frame.text, _index_begin, 'padx'=>0, 'pady'=>0, 'image'=> TkPhotoImage.new('data' => ERROR_9X9_GIF))
191
+ # end
192
+ @main_frame.text.insert(_index_begin,_txt, "#{_event.level}_msg")
193
+ _index_end = @main_frame.text.index('end')
194
+ if ['debug','error'].include?(_event.level)
195
+ parse_begin_row = _index_begin.split('.')[0].to_i-2
196
+ parse_end_row = _index_end.split('.')[0].to_i
197
+ parse_debug(parse_begin_row, parse_end_row)
198
+ end
199
+ @main_frame.text.see(_index_end)
200
+ @main_frame.text.mark_unset(_event.mark)
201
+ _event.mark="#{MARKSUF}#{_index_end}"
202
+ @main_frame.text.mark_set(_event.mark, "#{_index_end} - 1 lines -1 chars")
203
+ # if _event.instance_of?(MsgRunEvent)
204
+ # _b = TkButton.new(@main_frame.text,
205
+ # 'command'=>proc{_event.abort_action.call;_b.destroy},
206
+ # 'image'=> TkPhotoImage.new('data' => CLOSE_GIF),
207
+ # 'relief'=>'groove')
208
+ # TkTextWindow.new(@main_frame.text, 'end', 'window'=> _b)
209
+ # end
210
+ end
211
+
212
+ def parse_debug(_from_row=0, _to_row=-1)
211
213
  return if _from_row == _to_row
212
214
  _row = _from_row
213
215
  @cursor = @main_frame.text.cget('cursor')
@@ -218,9 +220,11 @@ class Output < ArcadiaExt
218
220
  else
219
221
  lines = @main_frame.text.value.to_a[_from_row.._to_row]
220
222
  end
221
- lines.each{|l|
222
- _row = _row+1
223
- #if _row >= _from_row
223
+
224
+ if lines
225
+ lines.each{|l|
226
+ _row = _row+1
227
+ #if _row >= _from_row
224
228
  _end = 0
225
229
  #m = /([\.\/]*[\/A-Za-z_\-\.]*[\.\/\w\d]*\.rb):(\d*)/.match(l)
226
230
  re = Regexp.new('([\w\:]*[\.\/]*[\/A-Za-z_\-\.]*[\.\/\w\d]*):(\d*)')
@@ -235,40 +239,40 @@ class Output < ArcadiaExt
235
239
  _line = m[2]
236
240
  _ibegin = _row.to_s+'.'+(m.begin(1)+_end).to_s
237
241
  _iend = _row.to_s+'.'+(m.end(2)+_end).to_s
238
- file_binding(_file, _line, _ibegin, _iend)
242
+ file_binding(_file, _line, _ibegin, _iend)
239
243
  end
240
244
  _end = m.end(2) + _end
241
-
245
+ end
246
+ m = re.match(_txt)
247
+ end
248
+ #m = re.match(_txt)
249
+ #end
250
+ }
251
+ end
252
+ end
242
253
 
243
- end
244
- m = re.match(_txt)
245
- end
246
- #end
254
+ def file_binding(_file, _line, _ibegin, _iend)
255
+ _line = '0' if _line.nil? || _line.strip.length == 0
256
+ tag_name = "tag_#{@j}"
257
+ @main_frame.text.tag_configure(tag_name,
258
+ 'foreground' => Arcadia.conf('hightlight.link.foreground'),
259
+ 'borderwidth'=>0,
260
+ 'relief'=>'flat',
261
+ 'underline'=>true
262
+ )
263
+ @main_frame.text.tag_add(tag_name,_ibegin,_iend)
264
+ @main_frame.text.tag_bind(tag_name,"Double-ButtonPress-1",
265
+ proc{
266
+ Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>_line))
247
267
  }
248
- end
268
+ )
269
+ @main_frame.text.tag_bind(tag_name,"Enter",
270
+ proc{@main_frame.text.configure('cursor'=> 'hand2')}
271
+ )
272
+ @main_frame.text.tag_bind(tag_name,"Leave",
273
+ proc{@main_frame.text.configure('cursor'=> @cursor)}
274
+ )
249
275
 
250
- def file_binding(_file, _line, _ibegin, _iend)
251
- _line = '0' if _line.nil? || _line.strip.length == 0
252
- tag_name = "tag_#{@j}"
253
- @main_frame.text.tag_configure(tag_name,
254
- 'foreground' => Arcadia.conf('hightlight.link.foreground'),
255
- 'borderwidth'=>0,
256
- 'relief'=>'flat',
257
- 'underline'=>true
258
- )
259
- @main_frame.text.tag_add(tag_name,_ibegin,_iend)
260
- @main_frame.text.tag_bind(tag_name,"Double-ButtonPress-1",
261
- proc{
262
- Arcadia.process_event(OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>_line))
263
- }
264
- )
265
- @main_frame.text.tag_bind(tag_name,"Enter",
266
- proc{@main_frame.text.configure('cursor'=> 'hand2')}
267
- )
268
- @main_frame.text.tag_bind(tag_name,"Leave",
269
- proc{@main_frame.text.configure('cursor'=> @cursor)}
270
- )
271
-
272
276
  end
273
277
 
274
278
  def out(_txt=nil, _tag=nil)