-
Notifications
You must be signed in to change notification settings - Fork 17
/
FilterDialog.py
3638 lines (3364 loc) · 213 KB
/
FilterDialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2003 - 2015 The Board of Regents of the University of Wisconsin System
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
"""This file implements the Filtering Dialog Box for the Transana application."""
__author__ = 'David Woods <[email protected]>, Kathleen Liston'
DEBUG = False
if DEBUG:
print "FilterDialog DEBUG is ON!!"
# Import wxPython
import wx
# Import wxPython's CheckListCtrl Mixin
from wx.lib.mixins.listctrl import CheckListCtrlMixin
# import Python's cPickle module
import cPickle
# import Python's os and sys module
import os, sys
# Import Transana's Collection Object (for the Clip List)
import Collection
# Import Transana's Custom ColorListCtrl
import ColorListCtrl
# Import Transana's DBInterface
import DBInterface
# import Transana's Dialogs module for the ErrorDialog.
import Dialogs
# import Transana's Miscellaneous Functions
import Misc
# import Transana's Constants
import TransanaConstants
# Import Transana's Globals
import TransanaGlobal
# Import Transana's Images
import TransanaImages
# Declare Constants for the Toolbar Button IDs
T_FILE_OPEN = wx.NewId()
T_FILE_SAVE = wx.NewId()
T_FILE_DELETE = wx.NewId()
T_CHECK_ALL = wx.NewId()
T_CHECK_NONE = wx.NewId()
T_HELP_HELP = wx.NewId()
T_FILE_EXIT = wx.NewId()
class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin):
""" This class turns a normal ListCtrl into a CheckListCtrl. """
def __init__(self, parent, multSelect=False):
# If multSelect is requested ...
if multSelect:
# ... create a ListCtrl in Report View that allows multiple selection
wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT)
# If multSelect is NOT requested ...
else:
# ... create a ListCtrl in Report View that only allows single selection
wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
# Make it a CheckList using the CheckListCtrlMixin
CheckListCtrlMixin.__init__(self)
# Bind the Item Activated method
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)
def OnItemActivated(self, event):
self.ToggleItem(event.m_itemIndex)
class FilterDialog(wx.Dialog):
""" This window implements Document, Episode, Quote, Clip, and Keyword filtering for Transana Reports.
Required parameters are:
parent
id (should be -1)
title
reportType 1 = Keyword Map (reportScope is the Episode Number)
2 = Keyword Visualization (reportScope is the Episode Number)
3 = Episode Analytic Data Export (reportScope is the Episode Number)
4 = Collection Clip Data Export (reportScope is the Collection Number, or 0 for Collection Root)
5 = Library Keyword Sequence Map (reportScope is the Library Number)
6 = Library Keyword Bar Graph (reportScope is the Series Number)
7 = Library Keyword Percentage Map (reportScope is the Series Number)
8 = Episode Clip Data Coder Reliabiltiy Export (reportScope is the Episode Number) (NOT IMPLEMENTED)
9 = Keyword Summary Report for all Keyword Groups (configSave not yet implemented) (reportScope is not yet defined)
10 = Library Report (reportScope is Library Number)
11 = Episode Report (reportScope is Episode Number)
12 = Collection Report (reportScope is Collection Number)
13 = Notes Report (reportScope is 1 for all notes, 2 for Series, 3 for Episodes, 4 for Transcripts, 5 for Collections,
6 for Clips, 7 for Snapshots, 8 for Documents, 9 for Quotes)
14 = Library Analytic Data Export (reportScope is the Series Number)
15 = Search Save (Search Saves have NO reportScope! or FilterDataType!!)
16 = Collection Keyword Map (reportScope is the CollectionNumber)
17 = Document Keyword Map (reportScope is the Document Number)
18 = Document Keyword Visualization (reportScope is the Document Number)
19 = Document Report (reportScope is the Document Number)
20 = Document Analytic Data Export (reportScope is the Document Number)
*** ADDING A REPORT TYPE? Remember to add the delete_filter_records() call to the appropriate
object's db_delete() method!
ALSO, remember to add the ReportScope conversion to XMLImport for Filter Imports!
ALSO, remember to add it to the OrphanCheck Unit Test! ***
Optional parameters are:
loadDefault (boolean) -- silently load a profile named "Default", if one exists
configName (current Configuration Name)
reportScope (required for Configuration Save/Load)
episodeFilter (boolean)
episodeSort (boolean)
transcriptFilter (boolean)
documentFilter (boolean)
collectionFilter (boolean)
collectionSort (boolean) * NOT FULLY IMPLEMENTED
quoteFilter (boolean)
clipFilter (boolean)
clipSort (boolean)
snapshotFilter (boolean)
keywordGroupFilter (boolean)
keywordGroupColor (boolean) * NOT FULLY IMPLEMENTED
keywordFilter (boolean)
keywordSort (boolean)
keywordColor (boolean)
notesFilter (boolean)
options (boolean)
startTime (number of milliseconds)
endTime (number of milliseconds)
barHeight (integer)
whitespace (integer)
hGridLines (boolean)
vGridLines (boolean)
singleLineDisplay (boolean)
showLegend (boolean)
colorOutput (boolean)
colorAsKeywords (boolean)
showSourceInfo (boolean)
showQuoteText (boolean)
showClipTranscripts (boolean)
showSnapshotImage (integer 0 = Full Size, 1 = Medium, 2 = Small, 3 = Don't Show)
showSnapshotCoding (boolean)
showKeywords (boolean)
showNestedData (boolean)
showHyperlink (boolean)
showFile (boolean)
showTime (boolean)
showComments (boolean)
showCollectionNotes (boolean)
showQuoteNotes (boolean)
showClipNotes (boolean)
showSnapshotNotes (boolean) """
def __init__(self, parent, id, title, reportType, **kwargs):
""" Initialize the Transana Filter Dialog Box """
# Create a Dialog Box
# Remember the keyword arguments
self.kwargs = kwargs
# See if we have a loadDefault argument and save it if we do.
if self.kwargs.has_key('loadDefault'):
self.loadDefault = self.kwargs['loadDefault']
else:
self.loadDefault = False
# Remember the report type
self.reportType = reportType
# Initialize the Report Configuration Name if one is passed in, if not, initialize to an empty string
if self.kwargs.has_key('configName'):
self.configName = self.kwargs['configName']
else:
self.configName = ''
# Remember the title
self.title = title
# If a configName exists ...
if self.configName != '':
# ... add it to the title for the window (but not what gets saved!)
title += ' - ' + self.configName
if self.kwargs.has_key('startTime'):
if reportType in [17]:
self.startTimeVal = "%s" % self.kwargs['startTime']
else:
self.startTimeVal = Misc.time_in_ms_to_str(self.kwargs['startTime'])
else:
self.startTimeVal = Misc.time_in_ms_to_str(0)
if self.kwargs.has_key('endTime'):
if self.kwargs['endTime']:
if reportType in [17]:
self.endTimeVal = "%s" % self.kwargs['endTime']
else:
self.endTimeVal = Misc.time_in_ms_to_str(self.kwargs['endTime'])
else:
if reportType in [17]:
self.endTimeVal = "%s" % parent.CharacterLength
else:
self.endTimeVal = Misc.time_in_ms_to_str(parent.MediaLength)
else:
self.endTimeVal = self.startTimeVal
# Initialize the dialog box.
# The form needs to be a bit larger on OSX
if 'wxMac' in wx.PlatformInfo:
formHeight = 610
else:
formHeight = 575
# Just to be clear, if we're loading the default, we don't actually SEE the dialog, but we still
# create it and populate all of its fields. That's the easiest way to load the default config!!
wx.Dialog.__init__(self, parent, id, title, size = (500, formHeight),
style= wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.NO_FULL_REPAINT_ON_RESIZE)
# Make the background White
self.SetBackgroundColour(wx.WHITE)
# Create BoxSizers for the Dialog
vBox = wx.BoxSizer(wx.VERTICAL)
hBox = wx.BoxSizer(wx.HORIZONTAL)
# Add the Tool Bar
self.toolBar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_TEXT)
# If there is a "reportScope" parameter, we should add Configuration Open, Save, and Delete buttons
if self.kwargs.has_key('reportScope'):
# Create the File Open button
btnFileOpen = self.toolBar.AddTool(T_FILE_OPEN, TransanaImages.ArtProv_FILEOPEN.GetBitmap(), shortHelpString=_("Load Filter Configuration"))
# Create the File Save button
btnFileSave = self.toolBar.AddTool(T_FILE_SAVE, TransanaImages.Save16.GetBitmap(), shortHelpString=_("Save Filter Configuration"))
# Create the Config Delete button
btnFileDelete = self.toolBar.AddTool(T_FILE_DELETE, TransanaImages.ArtProv_DELETE.GetBitmap(), shortHelpString=_("Delete Filter Configuration"))
# Create the Check All button
btnCheckAll = self.toolBar.AddTool(T_CHECK_ALL, TransanaImages.Check.GetBitmap(), shortHelpString=_('Check All'))
# Create the Uncheck All button
btnCheckNone = self.toolBar.AddTool(T_CHECK_NONE, TransanaImages.NoCheck.GetBitmap(), shortHelpString=_('Uncheck All'))
# create the Help button
btnHelp = self.toolBar.AddTool(T_HELP_HELP, TransanaImages.ArtProv_HELP.GetBitmap(), shortHelpString=_("Help"))
# Create the Exit button
btnExit = self.toolBar.AddTool(T_FILE_EXIT, TransanaImages.Exit.GetBitmap(), shortHelpString=_('Exit'))
# Realize the Toolbar
self.toolBar.Realize()
# Bind events to the Toolbar Buttons
# If there is a "reportScope" parameter, we should implement Configuration Open, Save, and Delete buttons
if self.kwargs.has_key('reportScope'):
self.Bind(wx.EVT_MENU, self.OnFileOpen, btnFileOpen)
self.Bind(wx.EVT_MENU, self.OnFileSave, btnFileSave)
self.Bind(wx.EVT_MENU, self.OnFileDelete, btnFileDelete)
self.Bind(wx.EVT_MENU, self.OnCheckAll, btnCheckAll)
self.Bind(wx.EVT_MENU, self.OnCheckAll, btnCheckNone)
self.Bind(wx.EVT_MENU, self.OnHelp, btnHelp)
self.Bind(wx.EVT_MENU, self.OnClose, btnExit)
# Add a spacer to the Sizer that allows for the Toolbar
vBox.Add(self.toolBar, 0, wx.BOTTOM | wx.EXPAND, 5)
# Everything in this Dialog goes inside a Notebook. Create that notebook control
self.notebook = wx.Notebook(self, -1)
# If Document Filtering is requested ...
if self.kwargs.has_key('documentFilter') and self.kwargs['documentFilter']:
# Set a flag for the presence of the Documents tab
self.documentFilter = True
else:
# Set a flag for the absence of the Documents tab
self.documentFilter = False
# If Episode Filtering is requested ...
if self.kwargs.has_key('episodeFilter') and self.kwargs['episodeFilter']:
# Set a flag for the presence of the Episodes tab
self.episodeFilter = True
else:
# Set a flag for the absence of the Episodes tab
self.episodeFilter = False
# If Quote Filtering is requested ...
if self.kwargs.has_key('quoteFilter') and self.kwargs['quoteFilter']:
# Set a flag for the presence of the Quotes tab
self.quoteFilter = True
else:
# Set a flag for the absence of the Quotes tab
self.quoteFilter = False
# If Clip Filtering is requested ...
if self.kwargs.has_key('clipFilter') and self.kwargs['clipFilter']:
# Set a flag for the presence of the Clips tab
self.clipFilter = True
else:
# Set a flag for the absence of the Clips tab
self.clipFilter = False
# If Snapshot Filtering is requested ...
if self.kwargs.has_key('snapshotFilter') and self.kwargs['snapshotFilter']:
# Set a flag for the presence of the Snapshots tab
self.snapshotFilter = True
else:
# Set a flag for the absence of the Snapshots tab
self.snapshotFilter = False
# If Keyword Filtering is requested ...
if self.kwargs.has_key('keywordFilter') and self.kwargs['keywordFilter']:
# Set a flag for the presence of the Keywords tab
self.keywordFilter = True
else:
# Set a flag for the absence of the Keywords tab
self.keywordFilter = False
# If Report Contents Specification is requested ...
if self.kwargs.has_key('reportContents') and self.kwargs['reportContents']:
# ... build a Panel for Report Contents ...
self.reportContentsPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
# ... place the Time Range Panel on the Notebook, creating a Time Range tab ...
self.notebook.AddPage(self.reportContentsPanel, _("Report Contents"))
# The Episode and Collection Reports need options for
# showing Clip Transcripts, showing Clip Keywords, and showing Nested Data
if self.kwargs.has_key('showNestedData'):
self.showNestedData = wx.CheckBox(self.reportContentsPanel, -1, _("Include Items from Nested Collections"))
self.showNestedData.SetValue(self.kwargs['showNestedData'])
pnlVSizer.Add(self.showNestedData, 0, wx.TOP | wx.LEFT, 10)
text1 = wx.StaticText(self.reportContentsPanel, -1, _("(Unchecking this will cause items from nested collections to\nbe skipped even if checked on the Quote, Clip or Snapshot tabs.)"))
pnlVSizer.Add(text1, 0, wx.LEFT, 30)
if self.kwargs.has_key('showHyperlink') and (self.quoteFilter or self.clipFilter or self.snapshotFilter):
self.showHyperlink = wx.CheckBox(self.reportContentsPanel, -1, _("Enable Hyperlinks"))
self.showHyperlink.SetValue(self.kwargs['showHyperlink'])
pnlVSizer.Add(self.showHyperlink, 0, wx.TOP | wx.LEFT, 10)
else:
self.showHyperlink = False
if self.kwargs.has_key('showFile') and (self.episodeFilter or self.documentFilter or self.quoteFilter or self.clipFilter or self.snapshotFilter):
self.showFile = wx.CheckBox(self.reportContentsPanel, -1, _("Show File Name"))
self.showFile.SetValue(self.kwargs['showFile'])
pnlVSizer.Add(self.showFile, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showTime') and \
(self.quoteFilter or self.episodeFilter or self.clipFilter or self.snapshotFilter):
if self.reportType == 10:
self.showTime = wx.CheckBox(self.reportContentsPanel, -1, _("Show Episode Length"))
elif self.reportType == 19:
self.showTime = wx.CheckBox(self.reportContentsPanel, -1, _("Show Quote Position"))
else:
self.showTime = wx.CheckBox(self.reportContentsPanel, -1, _("Show Item Time / Position"))
self.showTime.SetValue(self.kwargs['showTime'])
pnlVSizer.Add(self.showTime, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showDocImportDate') and (self.documentFilter):
self.showDocImportDate = wx.CheckBox(self.reportContentsPanel, -1, _("Show Document Import Date"))
self.showDocImportDate.SetValue(self.kwargs['showDocImportDate'])
pnlVSizer.Add(self.showDocImportDate, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showSourceInfo') and (self.quoteFilter or self.clipFilter or self.snapshotFilter):
self.showSourceInfo = wx.CheckBox(self.reportContentsPanel, -1, _("Show Source Information"))
self.showSourceInfo.SetValue(self.kwargs['showSourceInfo'])
pnlVSizer.Add(self.showSourceInfo, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showQuoteText') and self.quoteFilter:
self.showQuoteText = wx.CheckBox(self.reportContentsPanel, -1, _("Show Quote Text"))
self.showQuoteText.SetValue(self.kwargs['showQuoteText'])
pnlVSizer.Add(self.showQuoteText, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showClipTranscripts') and self.clipFilter:
self.showClipTranscripts = wx.CheckBox(self.reportContentsPanel, -1, _("Show Clip Transcripts"))
self.showClipTranscripts.SetValue(self.kwargs['showClipTranscripts'])
pnlVSizer.Add(self.showClipTranscripts, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showSnapshotImage') and self.snapshotFilter:
choices = [_('Large'), _('Medium'), _('Small'), _("Don't Show")]
self.showSnapshotImage = wx.RadioBox(self.reportContentsPanel, -1, _('Show Snapshots'), choices=choices)
self.showSnapshotImage.SetSelection(self.kwargs['showSnapshotImage'])
pnlVSizer.Add(self.showSnapshotImage, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showSnapshotCoding') and self.snapshotFilter:
self.showSnapshotCoding = wx.CheckBox(self.reportContentsPanel, -1, _('Show Snapshot Coding Key'))
self.showSnapshotCoding.SetValue(self.kwargs['showSnapshotCoding'])
pnlVSizer.Add(self.showSnapshotCoding, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showKeywords') and self.keywordFilter:
if self.reportType == 10:
prompt = _("Show Keywords")
else:
prompt = _("Show Item Keywords")
self.showKeywords = wx.CheckBox(self.reportContentsPanel, -1, prompt)
self.showKeywords.SetValue(self.kwargs['showKeywords'])
pnlVSizer.Add(self.showKeywords, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showComments'):
self.showComments = wx.CheckBox(self.reportContentsPanel, -1, _("Show Comments"))
self.showComments.SetValue(self.kwargs['showComments'])
pnlVSizer.Add(self.showComments, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showCollectionNotes'):
self.showCollectionNotes = wx.CheckBox(self.reportContentsPanel, -1, _("Show Collection Notes"))
self.showCollectionNotes.SetValue(self.kwargs['showCollectionNotes'])
pnlVSizer.Add(self.showCollectionNotes, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showQuoteNotes') and self.quoteFilter:
self.showQuoteNotes = wx.CheckBox(self.reportContentsPanel, -1, _("Show Quote Notes"))
self.showQuoteNotes.SetValue(self.kwargs['showQuoteNotes'])
pnlVSizer.Add(self.showQuoteNotes, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showClipNotes') and self.clipFilter:
self.showClipNotes = wx.CheckBox(self.reportContentsPanel, -1, _("Show Clip Notes"))
self.showClipNotes.SetValue(self.kwargs['showClipNotes'])
pnlVSizer.Add(self.showClipNotes, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('showSnapshotNotes') and self.snapshotFilter:
self.showSnapshotNotes = wx.CheckBox(self.reportContentsPanel, -1, _("Show Snapshot Notes"))
self.showSnapshotNotes.SetValue(self.kwargs['showSnapshotNotes'])
pnlVSizer.Add(self.showSnapshotNotes, 0, wx.TOP | wx.LEFT, 10)
# Now declare the panel's vertical sizer as the panel's official sizer
self.reportContentsPanel.SetSizer(pnlVSizer)
# Multiple selection has been implemented everywhere! Signal that it is allowed!!!
multSelect = True
# If Document Filtering is requested ...
if self.kwargs.has_key('documentFilter') and self.kwargs['documentFilter']:
# ... build a Panel for Documents ...
self.documentsPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Document Panel on the Notebook, creating a Documents tab ...
self.notebook.AddPage(self.documentsPanel, _("Documents"))
# ... place a Check List Ctrl on the Documents Panel ...
self.documentList = CheckListCtrl(self.documentsPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.documentList, 1, wx.EXPAND)
# The document List needs two columns, Document ID and Library ID.
self.documentList.InsertColumn(0, _("Document ID"))
self.documentList.InsertColumn(1, _("Library ID"))
# NOTE: The actual list of Documents needs to be provided by the calling routine using
# the SetDocuments method. This is because only the calling routine knows which
# Documents are legal and should be included in the list. We don't necessarily
# want all Documents all the time. The Document List should be in the form of an
# ordered list of tuples made up of (DocumentID, SeriesID, checked) information.
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND)
# Now declare the panel's vertical sizer as the panel's official sizer
self.documentsPanel.SetSizer(pnlVSizer)
# If Episode Filtering is requested ...
if self.kwargs.has_key('episodeFilter') and self.kwargs['episodeFilter']:
# ... build a Panel for Episodes ...
self.episodesPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Episode Panel on the Notebook, creating an Episodes tab ...
self.notebook.AddPage(self.episodesPanel, _("Episodes"))
# ... place a Check List Ctrl on the Episodes Panel ...
self.episodeList = CheckListCtrl(self.episodesPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.episodeList, 1, wx.EXPAND)
# The episode List needs two columns, Episode ID and Library ID.
self.episodeList.InsertColumn(0, _("Episode ID"))
self.episodeList.InsertColumn(1, _("Library ID"))
# If Episode Sorting capacity has been requested ...
if self.kwargs.has_key('episodeSort') and self.kwargs['episodeSort']:
# create a vertical sizer to hold the sort buttons
pnlBtnSizer = wx.BoxSizer(wx.VERTICAL)
# create a bitmap button for the Move Up button
self.btnEpUp = wx.BitmapButton(self.episodesPanel, -1, TransanaImages.ArtProv_UP.GetBitmap())
# Set the Tool Tip for the Move Up button
self.btnEpUp.SetToolTipString(_("Move episode up"))
# Bind the button event to a method
self.btnEpUp.Bind(wx.EVT_BUTTON, self.OnButton)
# Insert some expandable space into the button sizer at the top
pnlBtnSizer.Add((1,1), 1, wx.EXPAND)
# Add the Move Up button to the button sizer
pnlBtnSizer.Add(self.btnEpUp, 0, wx.ALIGN_CENTER | wx.ALL, 5)
# Add a spacer to the button sizer to increase the amount of space between the buttons
pnlBtnSizer.Add((1, 10))
# create a bitmap button for the Move Down button
self.btnEpDown = wx.BitmapButton(self.episodesPanel, -1, TransanaImages.ArtProv_DOWN.GetBitmap())
# Set the Tool Tip for the Move Down button
self.btnEpDown.SetToolTipString(_("Move episode down"))
# Bind the button event to a method
self.btnEpDown.Bind(wx.EVT_BUTTON, self.OnButton)
# Add the Move Down button to the button sizer
pnlBtnSizer.Add(self.btnEpDown, 0, wx.ALIGN_CENTER | wx.ALL, 5)
# Add some expandable space below the button to keep the buttons centered vertically
pnlBtnSizer.Add((1,1), 1, wx.EXPAND)
# Add the button sizer to the panel's Horizontal sizer
pnlHSizer.Add(pnlBtnSizer, 0, wx.EXPAND)
# NOTE: The actual list of Episodes needs to be provided by the calling routine using
# the SetEpisodes method. This is because only the calling routine knows which
# Episodes are legal and should be included in the list. We don't necessarily
# want all Episodes all the time. The Episode List should be in the form of an
# ordered list of tuples made up of (EpisodeID, SeriesID, checked) information.
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND)
# Now declare the panel's vertical sizer as the panel's official sizer
self.episodesPanel.SetSizer(pnlVSizer)
if self.kwargs.has_key('transcriptFilter'):
self.transcriptFilter = True
else:
self.transcriptFilter = False
#If transcript filter is requested... (Kathleen)
if self.transcriptFilter and self.kwargs['transcriptFilter']:
# ... build a Panel for Transcript List ...
self.transcriptPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Transcripts Panel on the Notebook, creating a Transcripts tab ...
self.notebook.AddPage(self.transcriptPanel, _("Transcripts"))
# ... place a Check List Ctrl on the Transcripts Panel ...
self.transcriptList = CheckListCtrl(self.transcriptPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.transcriptList, 1, wx.EXPAND)
# The Transcripts List needs four columns, Series, Episode, Transcript, and Number of Clips.
self.transcriptList.InsertColumn(0, _('Library'))
self.transcriptList.InsertColumn(1, _("Episode"))
self.transcriptList.InsertColumn(2, _("Transcript"))
self.transcriptList.InsertColumn(3, _("# Clips"))
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND, 0)
# Now declare the panel's vertical sizer as the panel's official sizer
self.transcriptPanel.SetSizer(pnlVSizer)
if self.kwargs.has_key('collectionFilter'):
self.collectionFilter = True
else:
self.collectionFilter = False
#If collection filter is requested... (Kathleen)
if self.collectionFilter and self.kwargs['collectionFilter']:
# ... build a Panel for Collections ...
self.collectionPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Collections Panel on the Notebook, creating a Collections tab ...
self.notebook.AddPage(self.collectionPanel, _("Collections"))
# ... place a Check List Ctrl on the Collections Panel ...
self.collectionList = CheckListCtrl(self.collectionPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.collectionList, 1, wx.EXPAND)
# The Collections List needs one column, Collection.
self.collectionList.InsertColumn(0, _("Collection"))
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND, 0)
# Now declare the panel's vertical sizer as the panel's official sizer
self.collectionPanel.SetSizer(pnlVSizer)
# If Quote Filtering is requested ...
if self.quoteFilter:
# ... build a Panel for Quotes ...
self.quotesPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Quotes Panel on the Notebook, creating a Quotes tab ...
self.notebook.AddPage(self.quotesPanel, _("Quotes"))
# ... place a Check List Ctrl on the Quotes Panel ...
self.quoteList = CheckListCtrl(self.quotesPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.quoteList, 1, wx.EXPAND)
# The Quote List needs two columns, Quote ID and Collection nesting.
self.quoteList.InsertColumn(0, _("Quote ID"))
self.quoteList.InsertColumn(1, _("Collection ID(s)"))
# NOTE: The actual list of Quotes needs to be provided by the calling routine using
# the SetQuotes method. This is because only the calling routine knows which
# Quotes are legal and should be included in the list. We don't necessarily
# want all Quotes all the time. The Quote List should be in the form of an
# ordered list of tuples made up of (collectionNum, quoteID, checked) information.
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND)
# Now declare the panel's vertical sizer as the panel's official sizer
self.quotesPanel.SetSizer(pnlVSizer)
# If Clip Filtering is requested ...
if self.clipFilter:
# ... build a Panel for Clips ...
self.clipsPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Clips Panel on the Notebook, creating a Clips tab ...
self.notebook.AddPage(self.clipsPanel, _("Clips"))
# ... place a Check List Ctrl on the Clips Panel ...
self.clipList = CheckListCtrl(self.clipsPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.clipList, 1, wx.EXPAND)
# The Clip List needs two columns, Clip ID and Collection nesting.
self.clipList.InsertColumn(0, _("Clip ID"))
self.clipList.InsertColumn(1, _("Collection ID(s)"))
# If Clip Sorting capacity has been requested ...
if self.kwargs.has_key('clipSort') and self.kwargs['clipSort']:
print "Clip Sorting has not yet been implemented."
# self.originalClipData will need to be reordered the same way that self.clipList is.
# Otherwise, GetClips won't work right!
# NOTE: The actual list of Clips needs to be provided by the calling routine using
# the SetClips method. This is because only the calling routine knows which
# Clips are legal and should be included in the list. We don't necessarily
# want all Clips all the time. The Clip List should be in the form of an
# ordered list of tuples made up of (collectionNum, clipID, checked) information.
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND)
# Now declare the panel's vertical sizer as the panel's official sizer
self.clipsPanel.SetSizer(pnlVSizer)
# If Snapshot Filtering is requested ...
if self.snapshotFilter:
# ... build a Panel for Snapshots ...
self.snapshotsPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Snapshots Panel on the Notebook, creating a Snapshots tab ...
self.notebook.AddPage(self.snapshotsPanel, _("Snapshots"))
# ... place a Check List Ctrl on the Snapshots Panel ...
self.snapshotList = CheckListCtrl(self.snapshotsPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.snapshotList, 1, wx.EXPAND)
# The Snapshot List needs two columns, Snapshot ID and Collection nesting.
self.snapshotList.InsertColumn(0, _("Snapshot ID"))
self.snapshotList.InsertColumn(1, _("Collection ID(s)"))
# If Snapshot Sorting capacity has been requested ...
if self.kwargs.has_key('snapshotSort') and self.kwargs['snapshotSort']:
print "Snapshot Sorting has not yet been implemented."
# self.originalSnapshotData will need to be reordered the same way that self.snapshotList is.
# Otherwise, GetSnapshots won't work right!
# NOTE: The actual list of Snapshots needs to be provided by the calling routine using
# the SetSnapshots method. This is because only the calling routine knows which
# Snapshots are legal and should be included in the list. We don't necessarily
# want all Snapshots all the time. The Snapshot List should be in the form of an
# ordered list of tuples made up of (snapshotNum, snapshotID, checked) information.
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND)
# Now declare the panel's vertical sizer as the panel's official sizer
self.snapshotsPanel.SetSizer(pnlVSizer)
if self.kwargs.has_key('keywordGroupFilter'):
self.keywordGroupFilter = True
else:
self.keywordGroupFilter = False
#If Keyword Group filter is requested... (Kathleen)
if self.keywordGroupFilter and self.kwargs['keywordGroupFilter']:
# ... build a Panel for Keyword Groups ...
self.keywordGroupPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Keyword Groups Panel on the Notebook, creating a Keyword Groups tab ...
self.notebook.AddPage(self.keywordGroupPanel, _("Keyword Groups"))
# Determine if Keyword Group Color specification is enabled or disabled.
if self.kwargs.has_key('keywordGroupColor') and self.kwargs['keywordGroupColor']:
self.keywordGroupColor = True
else:
self.keywordGroupColor = False
# If Keyword Group Color Specification is enabled ...
if self.keywordGroupColor:
# ... we need to use the ColorListCtrl for the Keyword Groups List.
self.keywordGroupList = ColorListCtrl.ColorListCtrl(self.keywordGroupPanel, multSelect=multSelect)
# If Keyword Group Color specification is disabled ...
else:
# ... place a Check List Ctrl on the Keyword Group Panel ...
self.keywordGroupList = CheckListCtrl(self.keywordGroupPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.keywordGroupList, 1, wx.EXPAND)
# The Keyword Groups List needs one column, Keyword Group.
self.keywordGroupList.InsertColumn(0, _("Keyword Group"))
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND, 0)
# Now declare the panel's vertical sizer as the panel's official sizer
self.keywordGroupPanel.SetSizer(pnlVSizer)
# If Keyword Filtering is requested ...
if self.keywordFilter:
# ... build a Panel for Keywords ...
self.keywordsPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Keywords Panel on the Notebook, creating a Keywords tab ...
self.notebook.AddPage(self.keywordsPanel, _("Keywords"))
# Determine if Keyword Color specification is enabled or disabled.
if self.kwargs.has_key('keywordColor') and self.kwargs['keywordColor']:
self.keywordColor = True
else:
self.keywordColor = False
# If Keyword Color Specification is enabled ...
if self.keywordColor:
# ... we need to use the ColorListCtrl for the Keywords List.
self.keywordList = ColorListCtrl.ColorListCtrl(self.keywordsPanel, multSelect=multSelect)
# If Keyword Color specification is disabled ...
else:
# ... place a Check List Ctrl on the Keywords Panel ...
self.keywordList = CheckListCtrl(self.keywordsPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.keywordList, 1, wx.EXPAND)
# The keyword List needs two columns, Keyword Group and Keyword.
self.keywordList.InsertColumn(0, _("Keyword Group"))
self.keywordList.InsertColumn(1, _("Keyword"))
# If Keyword Sorting capacity has been requested ...
if self.kwargs.has_key('keywordSort') and self.kwargs['keywordSort']:
# create a vertical sizer to hold the sort buttons
pnlBtnSizer = wx.BoxSizer(wx.VERTICAL)
# create a bitmap button for the Move Up button
self.btnKwUp = wx.BitmapButton(self.keywordsPanel, -1, TransanaImages.ArtProv_UP.GetBitmap())
# Set the Tool Tip for the Move Up button
self.btnKwUp.SetToolTipString(_("Move keyword up"))
# Bind the button event to a method
self.btnKwUp.Bind(wx.EVT_BUTTON, self.OnButton)
# Insert some expandable space into the button sizer at the top
pnlBtnSizer.Add((1,1), 1, wx.EXPAND)
# Add the Move Up button to the button sizer
pnlBtnSizer.Add(self.btnKwUp, 0, wx.ALIGN_CENTER | wx.ALL, 5)
# Add a spacer to the button sizer to increase the amount of space between the buttons
pnlBtnSizer.Add((1, 10))
# create a bitmap button for the Move Down button
self.btnKwDown = wx.BitmapButton(self.keywordsPanel, -1, TransanaImages.ArtProv_DOWN.GetBitmap())
# Set the Tool Tip for the Move Down button
self.btnKwDown.SetToolTipString(_("Move keyword down"))
# Bind the button event to a method
self.btnKwDown.Bind(wx.EVT_BUTTON, self.OnButton)
# Add the Move Down button to the button sizer
pnlBtnSizer.Add(self.btnKwDown, 0, wx.ALIGN_CENTER | wx.ALL, 5)
# Add some expandable space below the button to keep the buttons centered vertically
pnlBtnSizer.Add((1,1), 1, wx.EXPAND)
# Add the button sizer to the panel's Horizontal sizer
pnlHSizer.Add(pnlBtnSizer, 0, wx.EXPAND)
# NOTE: The actual list of Keywords needs to be provided by the calling routine using
# the SetKeywords method. This is because only the calling routine knows which
# Keywords are legal and should be included in the list. We don't necessarily
# want all Keywords all the time. The Keyword List should be in the form of an
# ordered list of tuples made up of (keywordgroup, keyword, checked) information.
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND, 0)
# Now declare the panel's vertical sizer as the panel's official sizer
self.keywordsPanel.SetSizer(pnlVSizer)
else:
self.keywordColor = False
if self.kwargs.has_key('notesFilter'):
self.notesFilter = True
else:
self.notesFilter = False
#If Notes filter is requested...
if self.notesFilter and self.kwargs['notesFilter']:
# ... build a Panel for Notes ...
self.notesPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# ... place the Notes Panel on the Notebook, creating a Notes tab ...
self.notebook.AddPage(self.notesPanel, _("Notes"))
# ... place a Check List Ctrl on the Notes Panel ...
self.notesList = CheckListCtrl(self.notesPanel, multSelect=multSelect)
# ... and place it on the panel's horizontal sizer.
pnlHSizer.Add(self.notesList, 1, wx.EXPAND)
# The Notes List needs two columns, Note ID and Parent.
self.notesList.InsertColumn(0, _("Note"))
self.notesList.InsertColumn(1, _("Parent"))
# Add the panel's horizontal sizer to the panel's vertical sizer so we can expand in two dimensions
pnlVSizer.Add(pnlHSizer, 1, wx.EXPAND, 0)
# Now declare the panel's vertical sizer as the panel's official sizer
self.notesPanel.SetSizer(pnlVSizer)
# If Options Specification is requested ...
if self.kwargs.has_key('options') and self.kwargs['options']:
# ... build a Panel for Options ...
self.optionsPanel = wx.Panel(self.notebook, -1)
# Create vertical and horizontal Sizers for the Panel
pnlVSizer = wx.BoxSizer(wx.VERTICAL)
# ... place the Time Range Panel on the Notebook, creating a Time Range tab ...
self.notebook.AddPage(self.optionsPanel, _("Options"))
# This gets a bit convoluted, as different reports can have different options. But it shouldn't be too bad.
# Episode Keyword Map Report, the Series Keyword Sequence Map, the Collection Keyword Map, and the Document
# Keyword Map have Start and End times on the Options tab
if self.reportType in [1, 5, 16, 17]:
# Add a label for the Start Time field
if self.reportType in [17]:
startTimeTxt = wx.StaticText(self.optionsPanel, -1, _("Start Position"))
else:
startTimeTxt = wx.StaticText(self.optionsPanel, -1, _("Start Time"))
pnlVSizer.Add(startTimeTxt, 0, wx.TOP | wx.LEFT, 10)
# Add the Start Time field
self.startTime = wx.TextCtrl(self.optionsPanel, -1, self.startTimeVal)
pnlVSizer.Add(self.startTime, 0, wx.LEFT, 10)
# Add a label for the End Time field
if self.reportType in [17]:
endTimeTxt = wx.StaticText(self.optionsPanel, -1, _("End Position"))
else:
endTimeTxt = wx.StaticText(self.optionsPanel, -1, _("End Time"))
pnlVSizer.Add(endTimeTxt, 0, wx.TOP | wx.LEFT, 10)
# Add the End Time field
self.endTime = wx.TextCtrl(self.optionsPanel, -1, self.endTimeVal)
pnlVSizer.Add(self.endTime, 0, wx.LEFT, 10)
# Add a note about using 0 for end-of-file position.
if self.reportType in [17]:
tRTxt = wx.StaticText(self.optionsPanel, -1, _("NOTE: Setting the End Position to 0 will set it to the end of the Document."))
else:
tRTxt = wx.StaticText(self.optionsPanel, -1, _("NOTE: Setting the End Time to 0 will set it to the end of the Media File."))
pnlVSizer.Add(tRTxt, 0, wx.ALL, 10)
# Keyword Map Report, Keyword Visualization, the Series Keyword Sequence Map, the Collection Keyword Map,
# the Document Keyword Map, and the Document Keyword Visualization
# have Bar height and Whitespace parameters as well as horizontal and vertical grid lines
if self.reportType in [1, 2, 5, 6, 7, 16, 17, 18]:
if self.kwargs.has_key('barHeight'):
# Add a label for the Bar Height field
barHeightTxt = wx.StaticText(self.optionsPanel, -1, _("Keyword Bar Height"))
pnlVSizer.Add(barHeightTxt, 0, wx.TOP | wx.LEFT, 10)
# Create a list of options for Bar Height
barHeightOptions = []
for x in range(2, 21):
barHeightOptions.append(str(x))
# Create a Choice Control of bar heights
self.barHeight = wx.Choice(self.optionsPanel, -1, choices=barHeightOptions)
# Set the initial value of the bar height
if self.kwargs.has_key('barHeight'):
self.barHeight.SetStringSelection(str(self.kwargs['barHeight']))
pnlVSizer.Add(self.barHeight, 0, wx.LEFT, 10)
if self.kwargs.has_key('whitespace'):
# Add a label for the Whitespace field
whitespaceTxt = wx.StaticText(self.optionsPanel, -1, _("Space Between Bars"))
pnlVSizer.Add(whitespaceTxt, 0, wx.TOP | wx.LEFT, 10)
# Create a list of options for whitespace
whitespaceOptions = []
for x in range(0, 6):
whitespaceOptions.append(str(x))
# Create a Choice Control of whitespace
self.whitespace = wx.Choice(self.optionsPanel, -1, choices=whitespaceOptions)
# Set the initial value of the whitespace
if self.kwargs.has_key('whitespace'):
self.whitespace.SetStringSelection(str(self.kwargs['whitespace']))
pnlVSizer.Add(self.whitespace, 0, wx.LEFT, 10)
# Keyword Map Report, Keyword Visualization, the Series Keyword Sequence Map, the Collection Keyword Map,
# and the Document Keyword Visualization have Bar height and Whitespace parameters as well as horizontal
# and vertical grid lines
if self.reportType in [1, 2, 5, 6, 7, 16, 17, 18]:
if self.kwargs.has_key('hGridLines'):
# Add a check box for Horizontal Grid Lines
self.hGridLines = wx.CheckBox(self.optionsPanel, -1, _("Horizontal Grid Lines"))
if self.kwargs.has_key('hGridLines') and self.kwargs['hGridLines']:
self.hGridLines.SetValue(True)
pnlVSizer.Add(self.hGridLines, 0, wx.TOP | wx.LEFT, 10)
if self.kwargs.has_key('vGridLines'):
# Add a check box for Vertical Grid Lines
self.vGridLines = wx.CheckBox(self.optionsPanel, -1, _("Vertical Grid Lines"))
if self.kwargs.has_key('vGridLines') and self.kwargs['vGridLines']:
self.vGridLines.SetValue(True)
pnlVSizer.Add(self.vGridLines, 0, wx.TOP | wx.LEFT, 10)
# If we have a Series Keyword Sequence Map
if self.reportType in [5] and self.kwargs.has_key('singleLineDisplay'):
# ... add a check box for the Single Line Display option
self.singleLineDisplay = wx.CheckBox(self.optionsPanel, -1, _("Single-line display"))
self.singleLineDisplay.SetValue(self.kwargs['singleLineDisplay'])
pnlVSizer.Add(self.singleLineDisplay, 0, wx.TOP | wx.LEFT, 10)
# If we have a Series Keyword Sequence Map, a Series Keyword Bar Graph, or a Series Keyword
# Percentage Graph ...
if self.reportType in [5, 6, 7] and self.kwargs.has_key('showLegend'):
# ... add a check box for the Show Legend option
self.showLegend = wx.CheckBox(self.optionsPanel, -1, _("Show Legend"))
self.showLegend.SetValue(self.kwargs['showLegend'])
pnlVSizer.Add(self.showLegend, 0, wx.TOP | wx.LEFT, 10)
# If the Single Line Display option is present ...
if self.reportType in [5] and self.kwargs.has_key('singleLineDisplay'):
# ... and is un-checked ...
if not self.kwargs['singleLineDisplay']:
# ... then disable the Show Legend option. There's no Legend for the multi-line display!
self.showLegend.Enable(False)
# Also, connect the Single Line Display with an event that handles enabling and disabling the Legend option
self.Bind(wx.EVT_CHECKBOX, self.OnSingleLineDisplay, self.singleLineDisplay)
# If we have a Keyword Map, a Series Keyword Sequence Map, a Series Keyword Bar Graph,
# a Series Keyword Percentage Graph, or a Collection Keyword Map ...
if self.reportType in [1, 5, 6, 7, 16, 17] and self.kwargs.has_key('colorOutput'):
# ... add a check box for Color (vs. GrayScale) output
self.colorOutput = wx.CheckBox(self.optionsPanel, -1, _("Color Output"))
self.colorOutput.SetValue(self.kwargs['colorOutput'])
pnlVSizer.Add(self.colorOutput, 0, wx.TOP | wx.LEFT, 10)
# If we have a Keyword Map or a Collection Keyword Map, we ask if color represents Clips or Keywords ...
if self.reportType in [1, 16, 17] and self.kwargs.has_key('colorAsKeywords'):
# Create a Horizontal Panel
pnlHSizer = wx.BoxSizer(wx.HORIZONTAL)
# Create a text label for the radiobox
txtLabel = wx.StaticText(self.optionsPanel, -1, _('Color represents:'))
# Add a horizontal spacer for the horizontal Sizer
pnlHSizer.Add((10, 0))
# Determine which platform we're on, and select the appropriate top offset for the text, based on platform
if 'wxMac' in wx.PlatformInfo:
topOffset = 6
else:
topOffset = 16
# Add the text label to the horizontal sizer with the appropriate top offset
pnlHSizer.Add(txtLabel, 0, wx.TOP, topOffset)
# ... add a Radio Box for Color as Clips vs. Color as Keywords
if self.reportType in [17]:
choices = [_('Quotes'), _('Keywords')]
else:
choices = [_('Clips'), _('Keywords')]
self.colorAsKeywords = wx.RadioBox(self.optionsPanel, -1, choices=choices,
majorDimension=2, style=wx.RA_SPECIFY_COLS)
# Set the appropriate radio button selection
self.colorAsKeywords.SetSelection(self.kwargs['colorAsKeywords'])
# Place the radio button on the horizontal sizer
pnlHSizer.Add(self.colorAsKeywords, 0, wx.LEFT, 10)
# Place the horizontal sizer into the main vertical sizer
pnlVSizer.Add(pnlHSizer, 0)
# Now declare the panel's vertical sizer as the panel's official sizer
self.optionsPanel.SetSizer(pnlVSizer)
# Place the Notebook in the Dialog Horizontal Sizer
hBox.Add(self.notebook, 1, wx.EXPAND, 10)
# Now place the Dialog's horizontal Sizer in the Dialog's Vertical sizer so we can expand in two dimensions
vBox.Add(hBox, 1, wx.EXPAND, 10)
# Create another horizontal sizer for the Dialog's buttons
btnBox = wx.BoxSizer(wx.HORIZONTAL)
# Create the OK button
self.btnOK = wx.Button(self, wx.ID_OK, _("OK"))
# Make this the default button
self.btnOK.SetDefault()
# Add the OK button to the dialog's Button sizer
btnBox.Add(self.btnOK, 0, wx.ALIGN_RIGHT | wx.LEFT | wx.RIGHT, 10)
# Bind an event to OK. (We need to override the default behavior or just closing.)
self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
# Create the Cancel button
btnCancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
# Add the Cancel button to the dialog's Button sizer
btnBox.Add(btnCancel, 0, wx.ALIGN_RIGHT | wx.LEFT | wx.RIGHT, 10)
# Create the Help button
btnHelp = wx.Button(self, -1, _("Help"))
# Add the Help Button to the Dialog's Button sizer
btnBox.Add(btnHelp, 0, wx.ALIGN_RIGHT | wx.LEFT | wx.RIGHT, 10)
# Bind the Help button to the appropriate method
btnHelp.Bind(wx.EVT_BUTTON, self.OnHelp)
# Now add the dialog's button sizer to the dialog's vertical sizer
vBox.Add(btnBox, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM)
# Declare the dialog's vertical sizer as the dialog's official sizer
self.SetSizer(vBox)
# Tell the dialog to auto-layout
self.SetAutoLayout(True)
# NOTE: The calling routine must provide additional data via the SetEpisodes, SetDocuments, SetQuotes, SetClips, and / or
# SetKeywords methods before this dialog is displayed. Therefore, we don't complete the Layout or call ShowModal here.
TransanaGlobal.CenterOnPrimary(self)
def OnClose(self, event):
""" Close the Filter Dialog """
self.Close()
def GetReportScope(self):
""" Different Report versions are based on different originating objects. This method returns the
correct record number (that is, the Report's Scope) for the originating object based on the Report Type. """
# Initialize Report Scope to None
reportScope = None
# ... check to see that an reportScope parameter was passed ...
if self.kwargs.has_key('reportScope'):
# ... and return the Episode Number as the Report's Scope.
reportScope = self.kwargs['reportScope']
# Return the Report Scope as the function result
return reportScope
def GetConfigNames(self):
""" Get a list of Configuration Names for the current Report Type and Report Scope. """
# Create a blank list
resList = []
# Get the Report's Scope
reportScope = self.GetReportScope()
# Make sure we have a legal Report
if reportScope != None:
# Get a Database Cursor
DBCursor = DBInterface.get_db().cursor()
# Build the database query
query = """ SELECT ConfigName FROM Filters2
WHERE ReportType = %s AND
ReportScope = %s
GROUP BY ConfigName
ORDER BY ConfigName """
# Set up the data values that match the query
values = (self.reportType, reportScope)
# Adjust the query for sqlite if needed
query = DBInterface.FixQuery(query)
# Execute the query with the data values
DBCursor.execute(query, values)
# Iterate through the report results
for (configName,) in DBCursor.fetchall():