clevic 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +182 -0
- data/Manifest.txt +7 -3
- data/README.txt +36 -23
- data/Rakefile +22 -7
- data/TODO +55 -45
- data/bin/clevic +7 -2
- data/config/hoe.rb +4 -2
- data/lib/clevic.rb +1 -0
- data/lib/clevic/browser.rb +38 -15
- data/lib/clevic/cache_table.rb +24 -8
- data/lib/clevic/db_options.rb +11 -8
- data/lib/clevic/delegates.rb +24 -13
- data/lib/clevic/extensions.rb +6 -2
- data/lib/clevic/field.rb +55 -6
- data/lib/clevic/item_delegate.rb +7 -6
- data/lib/clevic/model_builder.rb +35 -8
- data/lib/clevic/record.rb +28 -0
- data/lib/clevic/table_model.rb +21 -33
- data/lib/clevic/table_view.rb +48 -1
- data/lib/clevic/ui/browser.ui +4 -4
- data/lib/clevic/ui/browser_ui.rb +73 -74
- data/lib/clevic/ui/search_dialog_ui.rb +50 -51
- data/lib/clevic/version.rb +1 -1
- data/{accounts_models.rb → models/accounts_models.rb} +12 -12
- data/models/minimal_models.rb +19 -0
- data/models/times_models.rb +156 -0
- data/{times_models.rb → models/times_sqlite_models.rb} +10 -18
- data/{values_models.rb → models/values_models.rb} +2 -3
- data/script/console +1 -1
- data/sql/accounts.sql +48 -48
- data/sql/times.sql +25 -25
- data/sql/times_sqlite.sql +46 -0
- data/website/index.html +44 -18
- data/website/index.txt +8 -1
- data/website/template.html.erb +2 -1
- metadata +34 -8
data/lib/clevic/item_delegate.rb
CHANGED
@@ -19,16 +19,17 @@ class ItemDelegate < Qt::ItemDelegate
|
|
19
19
|
# This catches the event that begins the edit process.
|
20
20
|
# Not used at the moment.
|
21
21
|
def editorEvent ( event, model, style_option_view_item, model_index )
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
#~ if $options[:debug]
|
23
|
+
#~ puts "editorEvent"
|
24
|
+
#~ puts "event: #{event.inspect}"
|
25
|
+
#~ puts "model: #{model.inspect}"
|
26
|
+
#~ puts "style_option_view_item: #{style_option_view_item.inspect}"
|
27
|
+
#~ puts "model_index: #{model_index.inspect}"
|
28
|
+
#~ end
|
27
29
|
super
|
28
30
|
end
|
29
31
|
|
30
32
|
def createEditor( parent_widget, style_option_view_item, model_index )
|
31
|
-
puts "model_index.metadata.type: #{model_index.metadata.type.inspect}"
|
32
33
|
if model_index.metadata.type == :date
|
33
34
|
# not going to work here because being triggered by
|
34
35
|
# an alphanumeric keystroke (as opposed to F4)
|
data/lib/clevic/model_builder.rb
CHANGED
@@ -30,8 +30,31 @@ For example, a the UI for a model called Entry would be defined like this:
|
|
30
30
|
# :set is mandatory
|
31
31
|
restricted :vat, :label => 'VAT', :set => %w{ yes no all }, :tooltip => 'Is VAT included?'
|
32
32
|
distinct :description, :conditions => 'now() - date <= interval( 1 year )'
|
33
|
-
|
34
|
-
|
33
|
+
|
34
|
+
# this is a read-only field
|
35
|
+
plain :origin, :read_only => true
|
36
|
+
|
37
|
+
# for these, :format will be a dotted attribute accessor for the related
|
38
|
+
# ActiveRecord entity, in this case an instance of Account
|
39
|
+
relational :debit, :format => 'name', :class_name => 'Account', :conditions => 'active = true', :order => 'lower(name)'
|
40
|
+
relational :credit, :format => 'name', :class_name => 'Account', :conditions => 'active = true', :order => 'lower(name)'
|
41
|
+
|
42
|
+
# or like this to have an on-the-fly transform
|
43
|
+
# item will be an instance of Account
|
44
|
+
relational :credit, :format => lambda {|item| item.name.downcase}, :class_name => 'Account', :conditions => 'active = true', :order => 'lower(name)', :sample => 'Leilani Member Loan'
|
45
|
+
|
46
|
+
# this is a read-only display field from a related table
|
47
|
+
# the Entry class should then define a method called currency
|
48
|
+
# which returns an object that responds to 'short'.
|
49
|
+
# You can also use a Proc for :display
|
50
|
+
plain :currency, :display => 'short', :label => 'Currency'
|
51
|
+
|
52
|
+
# this is a read-only display field from a related table
|
53
|
+
# the Entry class should then define a method called currency
|
54
|
+
# which returns an object that responds to 'currency', which
|
55
|
+
# returns an object that responds to 'rate'.
|
56
|
+
# You can also use a Proc for :display
|
57
|
+
plain :some_field, :display => 'currency.rate', :label => 'Exchange Rate'
|
35
58
|
|
36
59
|
# this is optional
|
37
60
|
records :order => 'date,start'
|
@@ -63,6 +86,7 @@ class ModelBuilder
|
|
63
86
|
|
64
87
|
# an ordinary field, edited in place with a text box
|
65
88
|
def plain( attribute, options = {} )
|
89
|
+
options[:read_only] = true if options.has_key?( :display )
|
66
90
|
@fields << Clevic::Field.new( attribute.to_sym, model_class, options )
|
67
91
|
end
|
68
92
|
|
@@ -83,12 +107,15 @@ class ModelBuilder
|
|
83
107
|
|
84
108
|
# for foreign keys. Edited with a combo box using values from the specified
|
85
109
|
# path on the foreign key model object
|
86
|
-
|
110
|
+
# if options[:format] has a value, it's used either as a block
|
111
|
+
# or as a dotted path
|
112
|
+
def relational( attribute, options = {}, &block )
|
113
|
+
options[:display] ||= 'to_s'
|
87
114
|
unless options.has_key? :class_name
|
88
|
-
options[:class_name] = attribute.to_s.classify
|
115
|
+
options[:class_name] = model_class.reflections[attribute].class_name || attribute.to_s.classify
|
89
116
|
end
|
90
117
|
field = Clevic::Field.new( attribute.to_sym, model_class, options )
|
91
|
-
|
118
|
+
|
92
119
|
field.delegate = RelationalDelegate.new( @table_view, field.attribute_path, options )
|
93
120
|
@fields << field
|
94
121
|
end
|
@@ -119,8 +146,8 @@ class ModelBuilder
|
|
119
146
|
def build
|
120
147
|
# build the model with all it's collections
|
121
148
|
# using @model here because otherwise the view's
|
122
|
-
# reference to this very same model is
|
123
|
-
#
|
149
|
+
# reference to this very same model is garbage collected.
|
150
|
+
# TODO put @fields into TableModel, and access from there?
|
124
151
|
@model = Clevic::TableModel.new( self )
|
125
152
|
@model.object_name = @table_view.model_class.name
|
126
153
|
@model.dots = @fields.map {|x| x.column }
|
@@ -130,7 +157,7 @@ class ModelBuilder
|
|
130
157
|
|
131
158
|
# the data
|
132
159
|
@model.collection = records
|
133
|
-
# fill in an empty record
|
160
|
+
# fill in an empty record for data entry
|
134
161
|
@model.collection << model_class.new if @model.collection.size == 0
|
135
162
|
|
136
163
|
# now set delegates
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Clevic
|
2
|
+
|
3
|
+
# The base class for all Clevic model and UI definitions.
|
4
|
+
# minimal definition is like this
|
5
|
+
# class User < Clevic::Record; end
|
6
|
+
# This will automatically keep track of the order
|
7
|
+
# in which models are defined, so that tabs can
|
8
|
+
# be constructed in that order.
|
9
|
+
class Record < ActiveRecord::Base
|
10
|
+
include ActiveRecord::Dirty
|
11
|
+
self.abstract_class = true
|
12
|
+
@@subclass_order = []
|
13
|
+
|
14
|
+
def self.inherited( subclass )
|
15
|
+
@@subclass_order << subclass
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.models
|
20
|
+
@@subclass_order
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.models=( array )
|
24
|
+
@@subclass_order = array
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/clevic/table_model.rb
CHANGED
@@ -45,12 +45,6 @@ class TableModel < Qt::AbstractTableModel
|
|
45
45
|
@builder = builder
|
46
46
|
end
|
47
47
|
|
48
|
-
def hasChildren( *args )
|
49
|
-
puts 'hasChildren'
|
50
|
-
puts "args: #{args.inspect}"
|
51
|
-
super
|
52
|
-
end
|
53
|
-
|
54
48
|
def sort( col, order )
|
55
49
|
puts 'sort'
|
56
50
|
puts "col: #{col.inspect}"
|
@@ -162,31 +156,15 @@ class TableModel < Qt::AbstractTableModel
|
|
162
156
|
end
|
163
157
|
|
164
158
|
def flags( model_index )
|
159
|
+
retval = super
|
165
160
|
# TODO don't return IsEditable if the model is read-only
|
166
|
-
retval = qt_item_is_editable | super( model_index )
|
167
161
|
if model_index.metadata.type == :boolean
|
168
162
|
retval = item_boolean_flags
|
169
163
|
end
|
164
|
+
retval |= qt_item_is_editable.to_i unless model_index.field.read_only?
|
170
165
|
retval
|
171
166
|
end
|
172
167
|
|
173
|
-
def fetchMore( parent )
|
174
|
-
#~ puts "fetchMore"
|
175
|
-
#~ reload_data if canFetchMore( parent )
|
176
|
-
end
|
177
|
-
|
178
|
-
def canFetchMore( parent )
|
179
|
-
false
|
180
|
-
#~ puts "canFetchMore"
|
181
|
-
#~ puts "self.collection.size: #{self.collection.size.inspect}"
|
182
|
-
#~ puts "self.collection.sql_count: #{self.collection.sql_count.inspect}"
|
183
|
-
# Here, test for self.collection.size - new_records != self.collection.sql_count
|
184
|
-
# maintaining new_records will be the tricky part
|
185
|
-
#~ result = self.collection.size != self.collection.sql_count
|
186
|
-
#~ puts "result: #{result.inspect}"
|
187
|
-
#~ result
|
188
|
-
end
|
189
|
-
|
190
168
|
def reload_data( options = {} )
|
191
169
|
# renew cache
|
192
170
|
self.collection = self.collection.renew( options )
|
@@ -248,8 +226,7 @@ class TableModel < Qt::AbstractTableModel
|
|
248
226
|
begin
|
249
227
|
value = index.gui_value
|
250
228
|
unless value.nil?
|
251
|
-
field
|
252
|
-
field.do_format( value )
|
229
|
+
index.field.do_format( value )
|
253
230
|
end
|
254
231
|
rescue Exception => e
|
255
232
|
puts e.backtrace
|
@@ -262,21 +239,23 @@ class TableModel < Qt::AbstractTableModel
|
|
262
239
|
end
|
263
240
|
|
264
241
|
when qt_text_alignment_role
|
265
|
-
|
242
|
+
index.field.alignment
|
266
243
|
|
267
244
|
# these are just here to make debug output quieter
|
268
245
|
when qt_size_hint_role;
|
269
246
|
when qt_background_role;
|
270
247
|
when qt_font_role;
|
271
|
-
when qt_foreground_role
|
248
|
+
when qt_foreground_role
|
249
|
+
Qt::Color.new( 'dimgray' ) if index.field.read_only?
|
272
250
|
when qt_decoration_role;
|
273
251
|
|
274
252
|
# provide a tooltip when an empty relational field is encountered
|
275
253
|
when qt_tooltip_role
|
276
254
|
if index.metadata.type == :association
|
277
|
-
|
255
|
+
index.field.delegate.if_empty_message
|
278
256
|
end
|
279
257
|
|
258
|
+
'Read-only' if index.field.read_only?
|
280
259
|
else
|
281
260
|
puts "data index: #{index}, role: #{const_as_string(role)}" if $options[:debug]
|
282
261
|
nil
|
@@ -369,7 +348,7 @@ class TableModel < Qt::AbstractTableModel
|
|
369
348
|
# TODO this only works with single-dotted paths
|
370
349
|
when qt_paste_role
|
371
350
|
if index.metadata.type == :association
|
372
|
-
field =
|
351
|
+
field = index.field
|
373
352
|
association_class = field.class_name.constantize
|
374
353
|
candidates = association_class.find( :all, :conditions => [ "#{field.attribute_path[1]} = ?", variant.value ] )
|
375
354
|
case candidates.size
|
@@ -392,6 +371,13 @@ class TableModel < Qt::AbstractTableModel
|
|
392
371
|
end
|
393
372
|
end
|
394
373
|
|
374
|
+
def like_operator
|
375
|
+
case model_class.connection.adapter_name
|
376
|
+
when 'PostgreSQL'; 'ilike'
|
377
|
+
else; 'like'
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
395
381
|
# return a set of indexes that match the search criteria
|
396
382
|
def search( start_index, search_criteria )
|
397
383
|
# get the search value parameter, in SQL format
|
@@ -404,12 +390,10 @@ class TableModel < Qt::AbstractTableModel
|
|
404
390
|
|
405
391
|
# build up the conditions
|
406
392
|
bits = collection.build_sql_find( start_index.entity, search_criteria.direction )
|
407
|
-
conditions = "#{model_class.connection.quote_column_name( start_index.field_name )}
|
393
|
+
conditions = "#{model_class.connection.quote_column_name( start_index.field_name )} #{like_operator} :search_value"
|
408
394
|
conditions += ( " and " + bits[:sql] ) unless search_criteria.from_start?
|
409
395
|
params = { :search_value => search_value }
|
410
396
|
params.merge!( bits[:params] ) unless search_criteria.from_start?
|
411
|
-
#~ puts "conditions: #{conditions.inspect}"
|
412
|
-
#~ puts "params: #{params.inspect}"
|
413
397
|
# find the first match
|
414
398
|
entity = model_class.find(
|
415
399
|
:first,
|
@@ -426,6 +410,10 @@ class TableModel < Qt::AbstractTableModel
|
|
426
410
|
end
|
427
411
|
end
|
428
412
|
|
413
|
+
def field_for_index( model_index )
|
414
|
+
@builder.fields[model_index.column]
|
415
|
+
end
|
416
|
+
|
429
417
|
end
|
430
418
|
|
431
419
|
end #module
|
data/lib/clevic/table_view.rb
CHANGED
@@ -352,9 +352,17 @@ class TableView < Qt::TableView
|
|
352
352
|
end
|
353
353
|
end
|
354
354
|
|
355
|
+
def save_current_row
|
356
|
+
if !current_index.nil? && current_index.valid?
|
357
|
+
save_row( current_index )
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
355
361
|
# save the entity in the row of the given index
|
362
|
+
# actually, model.save will check if the record
|
363
|
+
# is really changed before writing to DB.
|
356
364
|
def save_row( index )
|
357
|
-
if index.valid?
|
365
|
+
if !index.nil? && index.valid?
|
358
366
|
saved = model.save( index )
|
359
367
|
if !saved
|
360
368
|
error_message = Qt::ErrorMessage.new( self )
|
@@ -362,6 +370,7 @@ class TableView < Qt::TableView
|
|
362
370
|
error_message.show_message( msg )
|
363
371
|
error_message.show
|
364
372
|
end
|
373
|
+
saved
|
365
374
|
end
|
366
375
|
end
|
367
376
|
|
@@ -392,10 +401,42 @@ class TableView < Qt::TableView
|
|
392
401
|
end
|
393
402
|
@index_override = false
|
394
403
|
end
|
404
|
+
|
405
|
+
# work around situation where an ItemDelegate is open
|
406
|
+
# when the surrouding tab is changed, but the right events
|
407
|
+
# don't arrive.
|
408
|
+
def hideEvent( event )
|
409
|
+
super
|
410
|
+
@hiding = true
|
411
|
+
end
|
412
|
+
|
413
|
+
# work around situation where an ItemDelegate is open
|
414
|
+
# when the surrouding tab is changed, but the right events
|
415
|
+
# don't arrive.
|
416
|
+
def showEvent( event )
|
417
|
+
super
|
418
|
+
@hiding = false
|
419
|
+
end
|
395
420
|
|
421
|
+
def focusOutEvent( event )
|
422
|
+
super
|
423
|
+
save_current_row
|
424
|
+
end
|
425
|
+
|
426
|
+
# this is the only method that is called when an itemDelegate is open
|
427
|
+
# and the tabs are changed.
|
428
|
+
# Work around situation where an ItemDelegate is open
|
429
|
+
# when the surrouding tab is changed, but the right events
|
430
|
+
# don't arrive.
|
431
|
+
def commitData( editor )
|
432
|
+
super
|
433
|
+
save_current_row if @hiding
|
434
|
+
end
|
435
|
+
|
396
436
|
# override to prevent tab pressed from editing next field
|
397
437
|
# also takes into account that override_next_index may have been called
|
398
438
|
def closeEditor( editor, end_edit_hint )
|
439
|
+
puts "end_edit_hint: #{end_edit_hint.inspect}"
|
399
440
|
case end_edit_hint
|
400
441
|
when Qt::AbstractItemDelegate.EditNextItem
|
401
442
|
super( editor, Qt::AbstractItemDelegate.NoHint )
|
@@ -413,7 +454,13 @@ class TableView < Qt::TableView
|
|
413
454
|
# If self.filter is false, use the data in the indexes to filter the data set;
|
414
455
|
# otherwise turn filtering off.
|
415
456
|
# Sets self.filter to true if filtering worked, false otherwise.
|
457
|
+
# indexes is a collection of Qt::ModelIndex
|
416
458
|
def filter_by_indexes( indexes )
|
459
|
+
unless indexes[0].field.filterable?
|
460
|
+
emit status_text( "Can't filter on #{indexes[0].field.label}" )
|
461
|
+
return
|
462
|
+
end
|
463
|
+
|
417
464
|
save_entity = current_index.entity
|
418
465
|
save_index = current_index
|
419
466
|
|
data/lib/clevic/ui/browser.ui
CHANGED
@@ -22,12 +22,12 @@
|
|
22
22
|
<x>0</x>
|
23
23
|
<y>0</y>
|
24
24
|
<width>727</width>
|
25
|
-
<height>
|
25
|
+
<height>28</height>
|
26
26
|
</rect>
|
27
27
|
</property>
|
28
28
|
<widget class="QMenu" name="menu_file" >
|
29
29
|
<property name="title" >
|
30
|
-
<string
|
30
|
+
<string>&File</string>
|
31
31
|
</property>
|
32
32
|
<addaction name="action_open" />
|
33
33
|
<addaction name="action_close" />
|
@@ -74,12 +74,12 @@
|
|
74
74
|
</action>
|
75
75
|
<action name="action_close" >
|
76
76
|
<property name="text" >
|
77
|
-
<string
|
77
|
+
<string>&Close</string>
|
78
78
|
</property>
|
79
79
|
</action>
|
80
80
|
<action name="action_recent" >
|
81
81
|
<property name="text" >
|
82
|
-
<string
|
82
|
+
<string>&Recent</string>
|
83
83
|
</property>
|
84
84
|
</action>
|
85
85
|
<action name="action_cut" >
|
data/lib/clevic/ui/browser_ui.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
=begin
|
2
2
|
** Form generated from reading ui file 'browser.ui'
|
3
3
|
**
|
4
|
-
** Created:
|
5
|
-
** by: Qt User Interface Compiler version 4.3.
|
4
|
+
** Created: Thu Jul 24 15:41:20 2008
|
5
|
+
** by: Qt User Interface Compiler version 4.3.3
|
6
6
|
**
|
7
7
|
** WARNING! All changes made in this file will be lost when recompiling ui file!
|
8
8
|
=end
|
@@ -25,7 +25,7 @@ class Ui_Browser
|
|
25
25
|
attr_reader :action_find_next
|
26
26
|
attr_reader :action_new_row
|
27
27
|
attr_reader :main_widget
|
28
|
-
attr_reader :
|
28
|
+
attr_reader :vboxLayout
|
29
29
|
attr_reader :statusbar
|
30
30
|
attr_reader :menubar
|
31
31
|
attr_reader :menu_file
|
@@ -34,60 +34,64 @@ class Ui_Browser
|
|
34
34
|
attr_reader :menu_model
|
35
35
|
|
36
36
|
def setupUi(browser)
|
37
|
-
browser.
|
38
|
-
|
37
|
+
if browser.objectName.nil?
|
38
|
+
browser.objectName = "browser"
|
39
|
+
end
|
40
|
+
browser.resize(727, 740)
|
41
|
+
icon = Qt::Icon.new("icon.png")
|
42
|
+
browser.windowIcon = icon
|
39
43
|
@action_open = Qt::Action.new(browser)
|
40
|
-
@action_open.
|
44
|
+
@action_open.objectName = "action_open"
|
41
45
|
@action_close = Qt::Action.new(browser)
|
42
|
-
@action_close.
|
46
|
+
@action_close.objectName = "action_close"
|
43
47
|
@action_recent = Qt::Action.new(browser)
|
44
|
-
@action_recent.
|
48
|
+
@action_recent.objectName = "action_recent"
|
45
49
|
@action_cut = Qt::Action.new(browser)
|
46
|
-
@action_cut.
|
50
|
+
@action_cut.objectName = "action_cut"
|
47
51
|
@action_copy = Qt::Action.new(browser)
|
48
|
-
@action_copy.
|
52
|
+
@action_copy.objectName = "action_copy"
|
49
53
|
@action_paste = Qt::Action.new(browser)
|
50
|
-
@action_paste.
|
54
|
+
@action_paste.objectName = "action_paste"
|
51
55
|
@action_filter = Qt::Action.new(browser)
|
52
|
-
@action_filter.
|
53
|
-
@action_filter.
|
56
|
+
@action_filter.objectName = "action_filter"
|
57
|
+
@action_filter.checkable = true
|
54
58
|
@action_find = Qt::Action.new(browser)
|
55
|
-
@action_find.
|
59
|
+
@action_find.objectName = "action_find"
|
56
60
|
@action_dump = Qt::Action.new(browser)
|
57
|
-
@action_dump.
|
61
|
+
@action_dump.objectName = "action_dump"
|
58
62
|
@action_refresh = Qt::Action.new(browser)
|
59
|
-
@action_refresh.
|
63
|
+
@action_refresh.objectName = "action_refresh"
|
60
64
|
@action_next = Qt::Action.new(browser)
|
61
|
-
@action_next.
|
65
|
+
@action_next.objectName = "action_next"
|
62
66
|
@action_previous = Qt::Action.new(browser)
|
63
|
-
@action_previous.
|
67
|
+
@action_previous.objectName = "action_previous"
|
64
68
|
@action_highlight = Qt::Action.new(browser)
|
65
|
-
@action_highlight.
|
69
|
+
@action_highlight.objectName = "action_highlight"
|
66
70
|
@action_new_window = Qt::Action.new(browser)
|
67
|
-
@action_new_window.
|
71
|
+
@action_new_window.objectName = "action_new_window"
|
68
72
|
@action_find_next = Qt::Action.new(browser)
|
69
|
-
@action_find_next.
|
73
|
+
@action_find_next.objectName = "action_find_next"
|
70
74
|
@action_new_row = Qt::Action.new(browser)
|
71
|
-
@action_new_row.
|
75
|
+
@action_new_row.objectName = "action_new_row"
|
72
76
|
@main_widget = Qt::Widget.new(browser)
|
73
|
-
@main_widget.
|
74
|
-
@
|
75
|
-
@
|
76
|
-
browser.
|
77
|
+
@main_widget.objectName = "main_widget"
|
78
|
+
@vboxLayout = Qt::VBoxLayout.new(@main_widget)
|
79
|
+
@vboxLayout.objectName = "vboxLayout"
|
80
|
+
browser.centralWidget = @main_widget
|
77
81
|
@statusbar = Qt::StatusBar.new(browser)
|
78
|
-
@statusbar.
|
79
|
-
browser.
|
82
|
+
@statusbar.objectName = "statusbar"
|
83
|
+
browser.statusBar = @statusbar
|
80
84
|
@menubar = Qt::MenuBar.new(browser)
|
81
|
-
@menubar.
|
82
|
-
@menubar.
|
85
|
+
@menubar.objectName = "menubar"
|
86
|
+
@menubar.geometry = Qt::Rect.new(0, 0, 727, 28)
|
83
87
|
@menu_file = Qt::Menu.new(@menubar)
|
84
|
-
@menu_file.
|
88
|
+
@menu_file.objectName = "menu_file"
|
85
89
|
@menu_edit = Qt::Menu.new(@menubar)
|
86
|
-
@menu_edit.
|
90
|
+
@menu_edit.objectName = "menu_edit"
|
87
91
|
@menu_search = Qt::Menu.new(@menubar)
|
88
|
-
@menu_search.
|
92
|
+
@menu_search.objectName = "menu_search"
|
89
93
|
@menu_model = Qt::Menu.new(@menubar)
|
90
|
-
@menu_model.
|
94
|
+
@menu_model.objectName = "menu_model"
|
91
95
|
browser.setMenuBar(@menubar)
|
92
96
|
|
93
97
|
@menubar.addAction(@menu_file.menuAction())
|
@@ -114,11 +118,6 @@ class Ui_Browser
|
|
114
118
|
|
115
119
|
retranslateUi(browser)
|
116
120
|
|
117
|
-
size = Qt::Size.new(727, 740)
|
118
|
-
size = size.expandedTo(browser.minimumSizeHint())
|
119
|
-
browser.resize(size)
|
120
|
-
|
121
|
-
|
122
121
|
Qt::MetaObject.connectSlotsByName(browser)
|
123
122
|
end # setupUi
|
124
123
|
|
@@ -127,41 +126,41 @@ class Ui_Browser
|
|
127
126
|
end
|
128
127
|
|
129
128
|
def retranslateUi(browser)
|
130
|
-
@action_open.
|
131
|
-
@action_close.
|
132
|
-
@action_recent.
|
133
|
-
@action_cut.
|
134
|
-
@action_copy.
|
135
|
-
@action_paste.
|
136
|
-
@action_filter.
|
137
|
-
@action_filter.
|
138
|
-
@action_filter.
|
139
|
-
@action_find.
|
140
|
-
@action_find.
|
141
|
-
@action_find.
|
142
|
-
@action_dump.
|
143
|
-
@action_dump.
|
144
|
-
@action_refresh.
|
145
|
-
@action_refresh.
|
146
|
-
@action_refresh.
|
147
|
-
@action_refresh.
|
148
|
-
@action_next.
|
149
|
-
@action_next.
|
150
|
-
@action_next.
|
151
|
-
@action_next.
|
152
|
-
@action_previous.
|
153
|
-
@action_previous.
|
154
|
-
@action_previous.
|
155
|
-
@action_highlight.
|
156
|
-
@action_highlight.
|
157
|
-
@action_new_window.
|
158
|
-
@action_find_next.
|
159
|
-
@action_find_next.
|
160
|
-
@action_new_row.
|
161
|
-
@menu_file.
|
162
|
-
@menu_edit.
|
163
|
-
@menu_search.
|
164
|
-
@menu_model.
|
129
|
+
@action_open.text = Qt::Application.translate("Browser", "&Open", nil, Qt::Application::UnicodeUTF8)
|
130
|
+
@action_close.text = Qt::Application.translate("Browser", "&Close", nil, Qt::Application::UnicodeUTF8)
|
131
|
+
@action_recent.text = Qt::Application.translate("Browser", "&Recent", nil, Qt::Application::UnicodeUTF8)
|
132
|
+
@action_cut.text = Qt::Application.translate("Browser", "Cut", nil, Qt::Application::UnicodeUTF8)
|
133
|
+
@action_copy.text = Qt::Application.translate("Browser", "Copy", nil, Qt::Application::UnicodeUTF8)
|
134
|
+
@action_paste.text = Qt::Application.translate("Browser", "Paste", nil, Qt::Application::UnicodeUTF8)
|
135
|
+
@action_filter.text = Qt::Application.translate("Browser", "F&ilter by current", nil, Qt::Application::UnicodeUTF8)
|
136
|
+
@action_filter.toolTip = Qt::Application.translate("Browser", "Filter by value in current field", nil, Qt::Application::UnicodeUTF8)
|
137
|
+
@action_filter.shortcut = Qt::Application.translate("Browser", "Ctrl+L", nil, Qt::Application::UnicodeUTF8)
|
138
|
+
@action_find.text = Qt::Application.translate("Browser", "&Find First", nil, Qt::Application::UnicodeUTF8)
|
139
|
+
@action_find.statusTip = Qt::Application.translate("Browser", "Find a row with some value", nil, Qt::Application::UnicodeUTF8)
|
140
|
+
@action_find.shortcut = Qt::Application.translate("Browser", "Ctrl+F", nil, Qt::Application::UnicodeUTF8)
|
141
|
+
@action_dump.text = Qt::Application.translate("Browser", "Dump", nil, Qt::Application::UnicodeUTF8)
|
142
|
+
@action_dump.shortcut = Qt::Application.translate("Browser", "Ctrl+Shift+D", nil, Qt::Application::UnicodeUTF8)
|
143
|
+
@action_refresh.text = Qt::Application.translate("Browser", "&Refresh", nil, Qt::Application::UnicodeUTF8)
|
144
|
+
@action_refresh.iconText = Qt::Application.translate("Browser", "Refresh current table from database", nil, Qt::Application::UnicodeUTF8)
|
145
|
+
@action_refresh.toolTip = Qt::Application.translate("Browser", "Refresh current table from database", nil, Qt::Application::UnicodeUTF8)
|
146
|
+
@action_refresh.shortcut = Qt::Application.translate("Browser", "Ctrl+R", nil, Qt::Application::UnicodeUTF8)
|
147
|
+
@action_next.text = Qt::Application.translate("Browser", "&Next", nil, Qt::Application::UnicodeUTF8)
|
148
|
+
@action_next.iconText = Qt::Application.translate("Browser", "Next", nil, Qt::Application::UnicodeUTF8)
|
149
|
+
@action_next.toolTip = Qt::Application.translate("Browser", "Next Model", nil, Qt::Application::UnicodeUTF8)
|
150
|
+
@action_next.shortcut = Qt::Application.translate("Browser", "Ctrl+Tab", nil, Qt::Application::UnicodeUTF8)
|
151
|
+
@action_previous.text = Qt::Application.translate("Browser", "&Previous", nil, Qt::Application::UnicodeUTF8)
|
152
|
+
@action_previous.toolTip = Qt::Application.translate("Browser", "Previous Model", nil, Qt::Application::UnicodeUTF8)
|
153
|
+
@action_previous.shortcut = Qt::Application.translate("Browser", "Ctrl+Shift+Backtab", nil, Qt::Application::UnicodeUTF8)
|
154
|
+
@action_highlight.text = Qt::Application.translate("Browser", "&Highlight", nil, Qt::Application::UnicodeUTF8)
|
155
|
+
@action_highlight.shortcut = Qt::Application.translate("Browser", "Ctrl+H", nil, Qt::Application::UnicodeUTF8)
|
156
|
+
@action_new_window.text = Qt::Application.translate("Browser", "&New Window", nil, Qt::Application::UnicodeUTF8)
|
157
|
+
@action_find_next.text = Qt::Application.translate("Browser", "Find &Next", nil, Qt::Application::UnicodeUTF8)
|
158
|
+
@action_find_next.shortcut = Qt::Application.translate("Browser", "Ctrl+G", nil, Qt::Application::UnicodeUTF8)
|
159
|
+
@action_new_row.text = Qt::Application.translate("Browser", "New &Row", nil, Qt::Application::UnicodeUTF8)
|
160
|
+
@menu_file.title = Qt::Application.translate("Browser", "&File", nil, Qt::Application::UnicodeUTF8)
|
161
|
+
@menu_edit.title = Qt::Application.translate("Browser", "Edit", nil, Qt::Application::UnicodeUTF8)
|
162
|
+
@menu_search.title = Qt::Application.translate("Browser", "&Search", nil, Qt::Application::UnicodeUTF8)
|
163
|
+
@menu_model.title = Qt::Application.translate("Browser", "&Table", nil, Qt::Application::UnicodeUTF8)
|
165
164
|
end # retranslateUi
|
166
165
|
|
167
166
|
def retranslate_ui(browser)
|