manqod 1.1575.0 → 1.1580.0
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.
- data/lib/About.rb +1 -1
- data/lib/FormHolder/Form.rb +3 -3
- data/lib/FormHolder/Form/InputHolder.rb +47 -33
- data/lib/FormHolder/Form/InputHolder/List.rb +0 -2
- data/lib/FormHolder/Form/InputHolder/MultiLine.rb +26 -0
- data/lib/ListHolder/EditableList/CellRenderers/Combo.rb +1 -1
- data/lib/ListHolder/EditableList/CellRenderers/Text.rb +1 -1
- data/lib/ListHolder/EditableList/Column.rb +15 -0
- data/lib/ListHolder/EditableList/DrbListModel.rb +2 -2
- metadata +3 -3
data/lib/About.rb
CHANGED
@@ -24,7 +24,7 @@ class About < Gtk::VBox
|
|
24
24
|
Gem.cache.gems.each_pair{|key,gem| v.add(gem.name,gem.version) if gem.name.include?("manqod") }
|
25
25
|
pack_start(Gtk::Label.new("User logged in: #{nick}"))
|
26
26
|
pack_start(Gtk::Label.new("Homepage of manqod: http://manqod.sourceforge.net"))
|
27
|
-
pack_start(Gtk::Label.new("
|
27
|
+
pack_start(Gtk::Label.new("LICENSE: CDDL
|
28
28
|
the author of this program(manqod) is Dobai-Pataky Balint(dpblnt@gmail.com)
|
29
29
|
manqod is released under the CDDL licence(http://www.opensource.org/licenses/cddl1.php) don't worry this only means the following:
|
30
30
|
* you can use it, copy it, modify it
|
data/lib/FormHolder/Form.rb
CHANGED
@@ -111,7 +111,7 @@ class MyForm < Gtk::Notebook
|
|
111
111
|
@ag=ag
|
112
112
|
ag.connect(Gdk::Keyval::GDK_KEY_space, Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE){
|
113
113
|
focused=@caller.holder.focus.parent
|
114
|
-
if focused
|
114
|
+
if focused && ["MySourceView"].include?(focused.class.name)
|
115
115
|
ret=focused.test_content
|
116
116
|
if ret
|
117
117
|
tell_exception("query is ok","fields: #{ret.num_fields}\n rows: #{ret.num_rows}","sql","normal",false)
|
@@ -120,13 +120,13 @@ class MyForm < Gtk::Notebook
|
|
120
120
|
}
|
121
121
|
ag.connect(Gdk::Keyval::GDK_KEY_f, Gdk::Window::CONTROL_MASK, Gtk::ACCEL_VISIBLE){
|
122
122
|
unless @caller.holder.focus.nil?
|
123
|
-
if (focused=@caller.holder.focus.parent) && focused.class.name
|
123
|
+
if (focused=@caller.holder.focus.parent) && ["MyRendererMultiline","MySourceView"].include?(focused.class.name) then
|
124
124
|
focused.run_search(self)
|
125
125
|
end
|
126
126
|
if (focused=@caller.holder.focus.parent) && ["MyRendererComboWithNew","MyRendererCombo","MyRendererConstCombo","FieldCombo"].include?(focused.class.name) then
|
127
127
|
focused.model.filterer.run(self)
|
128
128
|
end
|
129
|
-
if (focused=@caller.holder.focus.parent.parent) && focused.class.name
|
129
|
+
if (focused=@caller.holder.focus.parent.parent) && ["MyRendererList","FieldList"].include?(focused.class.name) then
|
130
130
|
focused.model.filterer.run(self)
|
131
131
|
end
|
132
132
|
end
|
@@ -8,7 +8,9 @@ class MyInputHolder
|
|
8
8
|
include Observable
|
9
9
|
include GtkAttributes
|
10
10
|
|
11
|
-
|
11
|
+
# The InputHolders is a container widget, holds input widets for the Form
|
12
|
+
#* item is a hash read from mysql
|
13
|
+
#* caller is the parent widget, usually the Form
|
12
14
|
def initialize(item,caller)
|
13
15
|
@item=item
|
14
16
|
@visibility=true
|
@@ -228,7 +230,7 @@ class MyInputHolder
|
|
228
230
|
item['querysql']=add_where(item['querysql'],"#{guess_base(item['querysql'])}.id = '" + "#" +"{default}'") if caller.runmode == 'info' && item['querysql'].length>0
|
229
231
|
self
|
230
232
|
end
|
231
|
-
|
233
|
+
# Sets the widget's gtk shadow
|
232
234
|
def set_shadow
|
233
235
|
shadow=case caller.runmode
|
234
236
|
when "info" then Gtk::SHADOW_ETCHED_IN
|
@@ -247,18 +249,23 @@ class MyInputHolder
|
|
247
249
|
@widget.set_shadow_type(shadow) unless shadow.nil?
|
248
250
|
end
|
249
251
|
|
252
|
+
# Returns the current value of the input widget
|
250
253
|
def text
|
251
254
|
renderer.text if renderer
|
252
255
|
end
|
253
|
-
|
256
|
+
|
257
|
+
# Returns the mysql field name of this widget
|
254
258
|
def data
|
255
259
|
item['data']
|
256
260
|
end
|
261
|
+
|
262
|
+
# Sets the default value, the Form uses this before update
|
257
263
|
def set_default(new_value)
|
258
264
|
item['default']=new_value
|
259
265
|
@default_is_set=true
|
260
266
|
self
|
261
267
|
end
|
268
|
+
|
262
269
|
def unset_default
|
263
270
|
@default_is_set=false
|
264
271
|
end
|
@@ -267,15 +274,18 @@ class MyInputHolder
|
|
267
274
|
@default_is_set == true
|
268
275
|
end
|
269
276
|
|
277
|
+
# Returns the default value of the input widget
|
270
278
|
def default
|
271
279
|
item['default']
|
272
280
|
end
|
273
|
-
|
281
|
+
|
282
|
+
# Sets the mysql field of this widget, the Form uses this
|
274
283
|
def set_data(da)
|
275
284
|
item['data']=da
|
276
285
|
self
|
277
286
|
end
|
278
|
-
|
287
|
+
|
288
|
+
#hides/unhides the widget
|
279
289
|
def set_visibility(vis)
|
280
290
|
@visibility=vis
|
281
291
|
@widget.set_no_show_all(!@visibility)
|
@@ -297,31 +307,31 @@ class MyInputHolder
|
|
297
307
|
set_shadow
|
298
308
|
self
|
299
309
|
end
|
300
|
-
|
310
|
+
# Returns the input widget type
|
301
311
|
def type
|
302
312
|
item['gtktype']
|
303
313
|
end
|
304
|
-
|
314
|
+
# Returns the input widget's initial value(set by the Form on init)
|
305
315
|
def initial
|
306
316
|
item["initial"]
|
307
317
|
end
|
308
|
-
|
318
|
+
# Returns the description of the input widget
|
309
319
|
def description
|
310
320
|
item['description']
|
311
321
|
end
|
312
|
-
|
322
|
+
# Returns the widget's query SQL, if there is one
|
313
323
|
def querySQL
|
314
324
|
item['querysql']
|
315
325
|
end
|
316
|
-
|
326
|
+
# Returns String 'true' if the widget is editable
|
317
327
|
def editable
|
318
328
|
editable?
|
319
329
|
end
|
320
|
-
|
330
|
+
# Returns boolean true if the widget is editable
|
321
331
|
def editable?
|
322
332
|
item['editable'].to_s.upcase=='TRUE'
|
323
333
|
end
|
324
|
-
|
334
|
+
|
325
335
|
def set_editable(ed=item['editable'])
|
326
336
|
item['editable']=parentM.batch? ? ed.to_s.upcase=='TRUE' && batch? : ed.to_s
|
327
337
|
renderer.set_sensitive(self.editable?)
|
@@ -336,7 +346,7 @@ class MyInputHolder
|
|
336
346
|
def batch?
|
337
347
|
(gtk_attribute("batch") || "false").upcase == "TRUE"
|
338
348
|
end
|
339
|
-
|
349
|
+
# Returns true if the widget will be included in the Form's query buiding; will it be saved?
|
340
350
|
def set_include_in_query_building(iqb=nil)
|
341
351
|
if(iqb.nil?) then
|
342
352
|
@include_in_query_building=nil
|
@@ -345,37 +355,41 @@ class MyInputHolder
|
|
345
355
|
end
|
346
356
|
self
|
347
357
|
end
|
348
|
-
|
349
|
-
def
|
358
|
+
# Sets the widget's min value, used only if widget is SpinButton
|
359
|
+
def set_min(l_min)
|
350
360
|
item["min"]=l_min.to_s
|
351
361
|
self
|
352
362
|
end
|
353
363
|
|
364
|
+
# Sets the widget's max value, used only if widget is SpinButton
|
354
365
|
def set_max(l_max)
|
355
366
|
item["max"]=l_max.to_s
|
356
367
|
self
|
357
368
|
end
|
358
|
-
|
369
|
+
# Returns widget's min value
|
359
370
|
def get_min
|
360
371
|
item["min"]
|
361
372
|
end
|
373
|
+
|
374
|
+
# Returns widget's max value
|
362
375
|
def get_max
|
363
376
|
item["max"]
|
364
377
|
end
|
365
|
-
|
378
|
+
# Returns String 'true' if the widget is required to have data entered by the user on Form submit
|
379
|
+
# If the widget has no data and the Form is submitted by the user, a warning popup window will be presented to the user
|
366
380
|
def required
|
367
381
|
item['required'].to_s=='true'
|
368
382
|
end
|
369
|
-
|
383
|
+
# Sets the required's value
|
370
384
|
def set_required(req)
|
371
385
|
item['required']=req.to_s
|
372
386
|
self
|
373
387
|
end
|
374
|
-
|
388
|
+
# Returns the widget's target module item
|
375
389
|
def target
|
376
390
|
item['to_call']
|
377
391
|
end
|
378
|
-
|
392
|
+
# Returns the widget's target runmode
|
379
393
|
def target_runmode
|
380
394
|
case parentM.runmode
|
381
395
|
when "info" then "info"
|
@@ -383,19 +397,19 @@ class MyInputHolder
|
|
383
397
|
else (text.to_i == -1 || text.to_i == 0 ? "add" : "modify" )
|
384
398
|
end
|
385
399
|
end
|
386
|
-
|
400
|
+
# Returns the widget's target module
|
387
401
|
def target_module
|
388
402
|
item['modname']
|
389
403
|
end
|
390
|
-
|
404
|
+
# Sets the widget's target module item
|
391
405
|
def set_target(new_target)
|
392
406
|
item['to_call']=new_target
|
393
407
|
end
|
394
|
-
|
408
|
+
# Returns the parent's selected id, usualy the calling List row's id
|
395
409
|
def parentselected
|
396
410
|
caller.parentselected
|
397
411
|
end
|
398
|
-
|
412
|
+
# Updates the widget
|
399
413
|
def update(notifier=nil,new_value=item['default'])
|
400
414
|
item['default']=new_value
|
401
415
|
edebug("Update notification from #{notifier} for #{data} = [#{new_value}]","form","info")
|
@@ -406,15 +420,15 @@ class MyInputHolder
|
|
406
420
|
diff=after-before
|
407
421
|
edebug("#{@item['gtktype']}:#{@item['data']} updated in #{diff.to_s}","time","info")
|
408
422
|
end
|
409
|
-
|
423
|
+
# Returns the parent module
|
410
424
|
def parentM
|
411
425
|
@caller
|
412
426
|
end
|
413
|
-
|
427
|
+
# Returns true if the widget handles multiediting
|
414
428
|
def multiselector?
|
415
429
|
gtk_attribute("multiselector") == "true"
|
416
430
|
end
|
417
|
-
|
431
|
+
# Returns the item's mysql field value
|
418
432
|
def short_data
|
419
433
|
if i=item['data'].rindex(".")
|
420
434
|
item['data'][i+1 .. item['data'].length]
|
@@ -422,7 +436,7 @@ class MyInputHolder
|
|
422
436
|
item['data']
|
423
437
|
end
|
424
438
|
end
|
425
|
-
|
439
|
+
# Runs the item's query sql and sets the item's default to the returned value
|
426
440
|
def run_query
|
427
441
|
@query_result=Hash.new
|
428
442
|
return false if item['querysql'].length<5
|
@@ -435,19 +449,19 @@ class MyInputHolder
|
|
435
449
|
item['default']=@query_result[short_data]
|
436
450
|
end
|
437
451
|
end
|
438
|
-
|
452
|
+
# This hack returns the contained widget's if this class is called without method
|
439
453
|
def method_missing(sym,*args)
|
440
454
|
renderer
|
441
455
|
end
|
442
|
-
|
456
|
+
# Reattaches the widget, useful on dynamic changing Forms and in the wysiwyg editor
|
443
457
|
def reattach
|
444
458
|
@caller.reattach(self)
|
445
459
|
end
|
446
|
-
|
460
|
+
# Sets if the widget is expanded
|
447
461
|
def set_expanded(exp)
|
448
462
|
@expander.set_expanded(exp)
|
449
463
|
end
|
450
|
-
|
464
|
+
# Identify this widget
|
451
465
|
def inspect
|
452
466
|
"InputHolder of #{renderer.inspect}"
|
453
467
|
end
|
@@ -455,5 +469,5 @@ class MyInputHolder
|
|
455
469
|
inspect
|
456
470
|
end
|
457
471
|
|
458
|
-
end
|
472
|
+
end
|
459
473
|
|
@@ -11,6 +11,28 @@ class MyRendererMultiline < Gtk::ScrolledWindow
|
|
11
11
|
@tv=Gtk::TextView.new(@source_buffer = Gtk::TextBuffer.new)
|
12
12
|
add(@tv)
|
13
13
|
@tv.modify_font(Pango::FontDescription.new('Monospace 10'))
|
14
|
+
@found_tag=@tv.buffer.create_tag('found',{'background' => 'yellow'})
|
15
|
+
@search_window=Gtk::Window.new(Gtk::Window::POPUP).set_destroy_with_parent(true).set_modal(true).set_window_position(Gtk::Window::POS_CENTER_ON_PARENT).set_decorated(false)
|
16
|
+
@search_window.add(Gtk::VBox.new.
|
17
|
+
pack_start(Gtk::Label.new("filter: #{item['description']}")).
|
18
|
+
pack_start(@entry=Gtk::Entry.new.set_can_focus(true).set_can_default(true))
|
19
|
+
)
|
20
|
+
|
21
|
+
@entry.signal_connect("key-release-event"){|me,ev|
|
22
|
+
@tv.buffer.remove_tag(@found_tag,@tv.buffer.start_iter,@tv.buffer.end_iter)
|
23
|
+
if ev.keyval == Gdk::Keyval::GDK_KEY_Escape
|
24
|
+
@search_window.hide
|
25
|
+
else
|
26
|
+
start_iter=@tv.buffer.start_iter
|
27
|
+
while bounds=start_iter.forward_search(me.text,Gtk::TextIter::SEARCH_TEXT_ONLY,nil)
|
28
|
+
@tv.buffer.apply_tag(@found_tag,bounds[0],bounds[1])
|
29
|
+
start_iter=bounds[1]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
}
|
33
|
+
@entry.signal_connect("activate"){|me|
|
34
|
+
@search_window.hide
|
35
|
+
}
|
14
36
|
end
|
15
37
|
attr_accessor :tv
|
16
38
|
attr_accessor :pc
|
@@ -44,6 +66,10 @@ class MyRendererMultiline < Gtk::ScrolledWindow
|
|
44
66
|
edebug("#{self} updated to #{item['default']}","form","info")
|
45
67
|
run_events(item['id'],'form_item-AfterUpdate')
|
46
68
|
end
|
69
|
+
|
70
|
+
def run_search(form_holder)
|
71
|
+
@search_window.set_transient_for(form_holder.get_ancestor(Gtk::Window)).show_all
|
72
|
+
end
|
47
73
|
|
48
74
|
def parentselected
|
49
75
|
@pc.parentselected
|
@@ -6,7 +6,7 @@ class MyCellRendererText < Gtk::CellRendererText
|
|
6
6
|
def initialize(column)
|
7
7
|
@jump_to_next=false
|
8
8
|
super()
|
9
|
-
set_ellipsize(
|
9
|
+
set_ellipsize(column.pango_ellipsize)
|
10
10
|
set_ellipsize_set(true)
|
11
11
|
# set_wrap_mode(Pango::WRAP_WORD)
|
12
12
|
signal_connect("edited") { |me,path,new_value|
|
@@ -194,6 +194,21 @@ class MyColumn < Gtk::TreeViewColumn
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
end
|
197
|
+
|
198
|
+
def pango_ellipsize
|
199
|
+
if gtk_attribute("ellipsize")
|
200
|
+
case gtk_attribute("ellipsize")
|
201
|
+
when 'NONE' then Pango::ELLIPSIZE_NONE
|
202
|
+
when 'START' then Pango::ELLIPSIZE_START
|
203
|
+
when 'END' then Pango::ELLIPSIZE_END
|
204
|
+
when 'MIDDLE' then Pango::ELLIPSIZE_MIDDLE
|
205
|
+
else Pango::ELLIPSIZE_NONE
|
206
|
+
end
|
207
|
+
else
|
208
|
+
Pango::ELLIPSIZE_NONE
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
197
212
|
def set_renderers_background
|
198
213
|
unless @list.list_model.column_of_background.nil?
|
199
214
|
add_attribute(@renderer,"cell-background",@list.list_model.column_of_background)
|
@@ -650,14 +650,14 @@ class ListModel
|
|
650
650
|
sql=sql+", "+moditem['additional_on_insert'] if moditem['additional_on_insert'].length>0
|
651
651
|
else
|
652
652
|
if moditem['additional_on_insert'].length>0
|
653
|
-
sql=sql
|
653
|
+
sql="#{sql} set #{moditem['additional_on_insert']}"
|
654
654
|
else
|
655
655
|
sql="#{sql} () VALUES()";
|
656
656
|
end
|
657
657
|
end
|
658
658
|
end
|
659
659
|
end
|
660
|
-
query(sql)
|
660
|
+
query(eeval("\"#{sql}\""))
|
661
661
|
inserted_id=qrow("select id from #{table} order by id desc limit 1")["id"].to_i
|
662
662
|
row_modified(inserted_id)
|
663
663
|
inserted_id
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 1580
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.1580.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Dobai-Pataky Balint
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-10-13 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|