clevic 0.13.0.b2 → 0.13.0.b3
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/clevic/filter_command.rb +8 -1
- data/lib/clevic/qt/table_view.rb +1 -1
- data/lib/clevic/table_view.rb +14 -8
- data/lib/clevic/version.rb +1 -1
- metadata +4 -4
@@ -1,5 +1,7 @@
|
|
1
1
|
module Clevic
|
2
2
|
class FilterCommand
|
3
|
+
# TODO seems like either filter_indexes, filter_conditions can be
|
4
|
+
# passed. Better docs needed, and better api.
|
3
5
|
def initialize( table_view, filter_indexes, filter_conditions )
|
4
6
|
@table_view = table_view
|
5
7
|
@filter_conditions = filter_conditions
|
@@ -7,7 +9,12 @@ module Clevic
|
|
7
9
|
|
8
10
|
# Better make the status message now, before the indexes become invalid
|
9
11
|
@status_message =
|
10
|
-
|
12
|
+
if filter_indexes.empty?
|
13
|
+
# no indexes, so use filter_conditions.
|
14
|
+
"Filtered on #{filter_conditions.inspect}"
|
15
|
+
else
|
16
|
+
"Filtered on #{filter_indexes.first.field.label} = #{filter_indexes.first.display_value}"
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
# Do the filtering. Return true if successful, false otherwise.
|
data/lib/clevic/qt/table_view.rb
CHANGED
@@ -348,7 +348,7 @@ class TableView < Qt::TableView
|
|
348
348
|
|
349
349
|
# make this window visible if it's in a TabWidget
|
350
350
|
# TODO doesn't really belong here because TableView will not always
|
351
|
-
# be in a TabWidget context.
|
351
|
+
# be in a TabWidget context. Should emit a signal which is a request to raise
|
352
352
|
def raise_widget
|
353
353
|
# the tab's parent is a StackedWiget, and its parent is TabWidget
|
354
354
|
tab_widget = parent.parent
|
data/lib/clevic/table_view.rb
CHANGED
@@ -312,7 +312,7 @@ class TableView
|
|
312
312
|
end
|
313
313
|
|
314
314
|
def selected_rows_or_current
|
315
|
-
indexes_or_current( selection_model.row_indexes )
|
315
|
+
indexes_or_current( selection_model.row_indexes.map{|row| model.create_index( row, 0 ) } )
|
316
316
|
end
|
317
317
|
|
318
318
|
# alternative access for auto_size_column
|
@@ -482,7 +482,7 @@ class TableView
|
|
482
482
|
def filter_by_options( args )
|
483
483
|
filtered.undo if filtered?
|
484
484
|
self.filtered = FilterCommand.new( self, [], args )
|
485
|
-
|
485
|
+
emit_filter_status( filtered.doit )
|
486
486
|
end
|
487
487
|
|
488
488
|
# Save the current entity, do something, then restore
|
@@ -584,8 +584,10 @@ class TableView
|
|
584
584
|
# or entity_model. Return nil if no match found.
|
585
585
|
# TODO doesn't really belong here because TableView will not always
|
586
586
|
# be in a TabWidget context.
|
587
|
-
|
588
|
-
|
587
|
+
unless instance_methods.include?( 'find_table_view' )
|
588
|
+
def find_table_view( entity_model_or_view )
|
589
|
+
raise "framework responsibility"
|
590
|
+
end
|
589
591
|
end
|
590
592
|
|
591
593
|
# execute the block with the TableView instance
|
@@ -593,15 +595,19 @@ class TableView
|
|
593
595
|
# Don't execute the block if nothing is found.
|
594
596
|
# TODO doesn't really belong here because TableView will not always
|
595
597
|
# be in a TabWidget context.
|
596
|
-
|
597
|
-
|
598
|
+
unless instance_methods.include?( 'with_table_view' )
|
599
|
+
def with_table_view( entity_model_or_view, &block )
|
600
|
+
raise "framework responsibility"
|
601
|
+
end
|
598
602
|
end
|
599
603
|
|
600
604
|
# make this window visible if it's in a TabWidget
|
601
605
|
# TODO doesn't really belong here because TableView will not always
|
602
606
|
# be in a TabWidget context.
|
603
|
-
|
604
|
-
|
607
|
+
unless instance_methods.include?( 'raise_widget' )
|
608
|
+
def raise_widget
|
609
|
+
raise "framework responsibility"
|
610
|
+
end
|
605
611
|
end
|
606
612
|
|
607
613
|
# set next_index for certain operations. Is only activated when
|
data/lib/clevic/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clevic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 161
|
5
5
|
prerelease: 7
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 13
|
9
9
|
- 0
|
10
10
|
- b
|
11
|
-
-
|
12
|
-
version: 0.13.0.
|
11
|
+
- 3
|
12
|
+
version: 0.13.0.b3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- John Anderson
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-01-
|
20
|
+
date: 2011-01-25 00:00:00 +02:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|