forked from sanyaade-machine-learning/Transana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControlObjectClass.py
3926 lines (3515 loc) · 219 KB
/
ControlObjectClass.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 module implements the Control Object class for Transana,
which is responsible for managing communication between the
four main windows. Each object (Menu, Visualization, Video, Transcript,
and Data) should communicate only with the Control Object, not with
each other.
"""
__author__ = 'David Woods <[email protected]>, Rajas Sambhare'
DEBUG = False
if DEBUG:
print "ControlObjectClass DEBUG is ON!"
# Import wxPython
import wx
# import Transana's Constants
import TransanaConstants
# Import the Menu Constants
import MenuSetup
# Import Transana's Global Values
import TransanaGlobal
# import the Transana Library Object definition
import Library
# import the Transana Episode Object definition
import Episode
# import the Transana Transcript Object definition
import Transcript
# import the Transana Document Object definition
import Document
# import the Transana Collection Object definition
import Collection
# import the Transana Clip Object definition
import Clip
# import teh Transana Quote Object definition
import Quote
# import the Transana Miscellaneous Routines
import Misc
# import Transana Database Interface
import DBInterface
# import Transana's Dialogs
import Dialogs
# import Transana's DragAndDrop Objects for Quick Clip creation
import DragAndDropObjects
# import Transana File Management System
import FileManagement
# import Play All Clips
import PlayAllClips
# import the Episode Transcript Change Propagation tool
import PropagateChanges
# import Transana's Snapshot object
import Snapshot
# import the Snapshot Window
import SnapshotWindow
# import Transana's Exceptions
import TransanaExceptions
# Import Transana's Transcript User Interface for creating supplemental Transcript Windows
if TransanaConstants.USESRTC:
import TranscriptionUI_RTC as TranscriptionUI
else:
import TranscriptionUI
# import Python's os module
import os
# import Python's sys module
import sys
# import Python's string module
import string
# Import Python's fast cPickle module
import cPickle
# import Python's pickle module
import pickle
class ControlObject(object):
""" The ControlObject operationalizes all inter-window and inter-object communication and control.
All objects should speak only to the ControlObject, not to each other directly. The purpose of
this is to allow greater modularity of code, so that modules can be swapped in and out in with
changes affecting only this object if the APIs change. """
def __init__(self):
""" Initialize the ControlObject """
# Define Objects that need controlling (initializing to None)
self.MenuWindow = None
self.VideoWindow = None
self.TranscriptWindow = None
self.shuttingDown = False # We need to signal when we want to shut down to prevent problems
# with the Visualization Window's IDLE event trying to call the
# VideoWindow after it's been destroyed.
# We need to know what transcript is "Active" (most recently selected) at any given point. -1 signals none.
self.activeTranscript = -1
self.VisualizationWindow = None
self.DataWindow = None
# Keep track of all Snapshot Windows that are opened
self.SnapshotWindows = []
self.PlayAllClipsWindow = None
self.NotesBrowserWindow = None
self.ChatWindow = None
# Keep track of all Report, Map, and Graph Windows that are opened
self.ReportWindows = {}
# Initialize variables
self.VideoFilename = '' # Video File Name
self.VideoStartPoint = 0 # Starting Point for video playback in Milliseconds
self.VideoEndPoint = 0 # Ending Point for video playback in Milliseconds
self.WindowPositions = [] # Initial Screen Positions for all Windows, used for Presentation Mode
self.TranscriptNum = {} # Transcript Num is a dictionary with Transcript Number as key and (Tab, Pane) as data
self.currentObj = None # Currently loaded Object (Episode or Clip)
self.reportNumber = 0 # Report Number, for tracking reports in the Window Menu
# Have the Export Directory default to the Video Root, but then remember its changed value for the session
self.defaultExportDir = TransanaGlobal.configData.videoPath
self.playInLoop = False # Should we loop playback?
self.LoopPresMode = None # What presentation mode are we ignoring while Looping?
self.shutdownPlayAllClips = False # Flag to signal the need to reformat the screen following Play All Clips
def Register(self, Menu='', Video='', Transcript='', Data='', Visualization='', PlayAllClips='', NotesBrowser='', Chat=''):
""" The ControlObject can extert control only over those objects it knows about. This method
provides a way to let the ControlObject know about other objects. This infrastructure allows
for objects to be swapped in and out. For example, if you need a different video window
that supports a format not available on the current one, you can hide the current one, show
a new one, and register that new one with the ControlObject. Once this is done, the new
player will handle all tasks for the program. """
# This function expects parameters passed by name and "registers" the components that
# need to be available to the ControlObject to be controlled. To remove an
# object registration, pass in "None"
if Menu != '':
self.MenuWindow = Menu # Define the Menu Window Object
if Video != '':
self.VideoWindow = Video # Define the Video Window Object
if Transcript != '':
# Define the Transcript Window Object
self.TranscriptWindow = Transcript
## # Add the Transcript Number to the list of Transcript Numbers
## self.TranscriptNum.append(0)
## # Set the new Transcript to be the Active Transcript
## self.activeTranscript = len(self.TranscriptWindow) - 1
if Data != '':
self.DataWindow = Data # Define the Data Window Object
if Visualization != '':
self.VisualizationWindow = Visualization # Define the Visualization Window Object
if PlayAllClips != '':
self.PlayAllClipsWindow = PlayAllClips # Define the Play All Clips Window Object
if NotesBrowser != '':
self.NotesBrowserWindow = NotesBrowser # Define the Notes Browser Window Object
if Chat != '':
self.ChatWindow = Chat # Define the Chat Window Object
def CloseAll(self):
""" This method closes all application windows and cleans up objects when the user
quits Transana. """
# Closing the MenuWindow will automatically close the Transcript, Data, and Visualization
# Windows in the current setup of Transana, as these windows are all defined as child dialogs
# of the MenuWindow.
self.MenuWindow.Close()
# VideoWindow needs to be closed explicitly.
self.VideoWindow.close()
def CloseCurrentTranscript(self, event):
""" Close the current Transcript Window """
# Have the Transcript Window close the current Pane or Panel
self.TranscriptWindow.CloseCurrent(event)
def CloseAllImages(self):
""" Close all Snapshot Windows """
# For each Shapshot Window (from the end of the list to the start) ...
while len(self.SnapshotWindows) > 0:
# ... close it, thus releasing any records that might be locked there.
self.SnapshotWindows[len(self.SnapshotWindows) - 1].Close()
def CloseAllReports(self):
""" Close all Report Windows """
# For each Report Window (from the end of the list to the start) ...
while len(self.ReportWindows) > 0:
# ... close it, thus releasing any records that might be locked there.
self.ReportWindows[self.ReportWindows.keys()[len(self.ReportWindows) - 1]].Close()
def IconizeAll(self, iconize):
""" Have all windows minimize and restore together """
self.MenuWindow.Iconize(iconize)
self.VisualizationWindow.Iconize(iconize)
self.VideoWindow.Iconize(iconize)
# The TranscriptWindow sometimes MUST be called here, while other times it isn't needed.
self.TranscriptWindow.Iconize(iconize)
self.DataWindow.Iconize(iconize)
for win in self.SnapshotWindows:
win.Iconize(iconize)
if self.NotesBrowserWindow != None:
self.NotesBrowserWindow.Iconize(iconize)
# The File Management Window also does not need to be processed here.
# For each Report Window ...
for win in self.ReportWindows.keys():
# ... minimize/restore the Report
self.ReportWindows[win].Iconize(iconize)
def LoadDocument(self, library_name, document_name, document_number):
""" When a Document is identified to trigger systemic loading of all related information,
this method should be called so that all Transana Objects are set appropriately. """
# Initialize a variable indicating if we found the requested document
documentFound = False
# First, see if the selected Document is already loaded! Iterate through the TranscriptWindow's Notebook Tabs ...
for y in range(self.TranscriptWindow.nb.GetPageCount()):
for pane in self.TranscriptWindow.nb.GetPage(y).GetChildren():
# ... and get a pointer to the tab's active Splitter panel's editor's data object
dataObj = pane.editor.TranscriptObj
# If the data object is not None, then something IS loaded
if dataObj is not None:
# If the data object is a Document (not a Transcript) and the Document has the same NAME ...
if isinstance(dataObj, Document.Document) and (document_name == dataObj.id):
# ... load the data object's Library
library = Library.Library(dataObj.library_num)
# Also load the Database copy of this Document, so we can check that it's up to date
# and hasn't been updated by another user.
dbDataObj = Document.Document(document_number)
# If that library name matches the one we're opening ...
if (library_name == library.id):
# ... then the requested Document is already open. Select its Notebook Page ...
self.TranscriptWindow.nb.SetSelection(y)
# ... and select the correct Splitter Pane as the "Active" pane.
self.TranscriptWindow.nb.GetCurrentPage().ActivatePanel(pane.panelNum)
# Note that the document was found
documentFound = True
# We can stop looking now
break
# If the document is found ...
if documentFound:
# ... we can interrupt this loop too!
break
# If the requested document was not found, or if it is not CURRENT (if another user has edited it!) ...
if not documentFound or ((dataObj != None) and (dataObj.lastsavetime != dbDataObj.lastsavetime)):
# If the document was not found but the current page is not empty ...
if not documentFound and (dataObj != None):
# ... create a new Notebook Page for the Document
self.TranscriptWindow.AddNotebookPage(document_name)
# Select the new page as the current page
self.TranscriptWindow.nb.SetSelection(self.TranscriptWindow.nb.GetPageCount() - 1)
# If the current Document Window's Notebook Page IS empty ...
else:
self.TranscriptWindow.nb.SetPageText(self.TranscriptWindow.nb.GetSelection(), document_name)
# Load the Document
tmpDocument = Document.Document(document_number)
# Load the Document into the Editor Interface (Transcripts and Documents act the same here!)
self.TranscriptWindow.LoadTranscript(tmpDocument)
# Set the new Current Object
self.currentObj = tmpDocument
# If we don't yet know the Document Length ...
if (self.currentObj.document_length == 0) and (self.TranscriptWindow.dlg.editor.GetLength() > 0):
# ... let's grab it here and save it. Otherwise, Visualizations don't work, etc.
# ... lock the document ...
self.currentObj.lock_record()
# ... add the length ...
self.currentObj.document_length = self.TranscriptWindow.dlg.editor.GetLength()
# ... save the record ...
self.currentObj.db_save()
# ... and unlock the record
self.currentObj.unlock_record()
# Update the Transana Interface for this object
self.UpdateCurrentObject(tmpDocument)
# And tell the Visualization Window to draw itself.
self.VisualizationWindow.Refresh()
# Enable the transcript menu item options
self.MenuWindow.SetTranscriptOptions(True)
def LoadTranscript(self, library, episode, transcript):
""" When a Transcript is identified to trigger systemic loading of all related information,
this method should be called so that all Transana Objects are set appropriately. """
# First, let's see if there's already a video loaded in the system. Iterate through all Notebook Pages.
self.BringTranscriptToFront()
# Before we do anything else, let's save the current transcript if it's been modified.
if self.TranscriptWindow.TranscriptModified():
if TransanaConstants.partialTranscriptEdit:
self.SaveTranscript(1, cleardoc=1, continueEditing=False)
else:
self.SaveTranscript(1, cleardoc=1)
# If the current Editor is a Document (not None, not a Transcript) ...
if isinstance(self.TranscriptWindow.GetCurrentObject(), Document.Document) or \
isinstance(self.TranscriptWindow.GetCurrentObject(), Quote.Quote):
# ... create a new Notebook Page for the Document
self.TranscriptWindow.AddNotebookPage(transcript)
# Select the new page as the current page
self.TranscriptWindow.nb.SetSelection(self.TranscriptWindow.nb.GetPageCount() - 1)
# If the current Editor is a Transcript (not None, not a Document) ...
elif isinstance(self.TranscriptWindow.GetCurrentObject(), Transcript.Transcript):
# ... then we need to Clear all Windows of media information
self.ClearAllWindows(clearAllPanes=True)
if self.currentObj != None:
# ... create a new Notebook Page for the Document
self.TranscriptWindow.AddNotebookPage(transcript)
# Select the new page as the current page
self.TranscriptWindow.nb.SetSelection(self.TranscriptWindow.nb.GetPageCount() - 1)
# Because transcript names can be identical for different episodes in different Library, all parameters are mandatory.
# They are:
# Library - the Library associated with the desired Transcript
# episode - the Episode associated with the desired Transcript
# transcript - the Transcript to be displayed in the Transcript Window
libraryObj = Library.Library(library) # Load the Library which owns the Episode which owns the Transcript
episodeObj = Episode.Episode(series=libraryObj.id, episode=episode) # Load the Episode in the Library that owns the Transcript
# Set the current object to the loaded Episode
self.currentObj = episodeObj
transcriptObj = Transcript.Transcript(transcript, ep=episodeObj.number)
# Load the Transcript in the Episode in the Library
# reset the video start and end points
self.VideoStartPoint = 0 # Set the Video Start Point to the beginning of the video
self.VideoEndPoint = 0 # Set the Video End Point to 0, indicating that the video should not end prematurely
# Remove any tabs in the Data Window beyond the Database Tab
self.DataWindow.DeleteTabs()
if self.LoadVideo(self.currentObj): # Load the video identified in the Episode
# Delineate the appropriate start and end points for Video Control. (Required to prevent Waveform Visualization problems)
self.SetVideoSelection(0, 0)
# Force the Visualization to load here. This ensures that the Episode visualization is shown
# rather than the Clip visualization when Locating a Clip
self.VisualizationWindow.OnIdle(None)
# If we have only one video file ...
if len(self.currentObj.additional_media_files) == 0:
# Identify the loaded media file
prompt = unicode(_('Video Media File: "%s"'), 'utf8')
# Place the file name in the video window's Title bar
self.VideoWindow.SetTitle(prompt % episodeObj.media_filename)
# If there are multiple videos ...
else:
# Just label the video window generically. There's not room for file names.
self.VideoWindow.SetTitle(_("Media"))
# Open Transcript in Transcript Window
self.TranscriptWindow.LoadTranscript(transcriptObj) #flies off to transcriptionui.py
self.currentObj = episodeObj
# Update the Transana Interface for this object
self.UpdateCurrentObject(transcriptObj)
# Add the Transcript Number to the list that tracks the numbers of the open transcripts
self.TranscriptNum[transcriptObj.number] = (self.TranscriptWindow.nb.GetSelection(), self.TranscriptWindow.nb.GetPage(self.TranscriptWindow.nb.GetSelection()).activePanel)
## # Add the Episode Clips Tab to the DataWindow
## self.DataWindow.AddItemsTab(libraryObj=libraryObj, dataObj=episodeObj)
##
## # Add the Selected Episode Clips Tab, initially set to the beginning of the video file
## # TODO: When the Transcript Window updates the selected text, we need to update this tab in the Data Window!
## self.DataWindow.AddSelectedItemsTab(libraryObj=libraryObj, dataObj=episodeObj, timeCode=0)
##
## # Add the Keyword Tab to the DataWindow
## self.DataWindow.AddKeywordsTab(seriesObj=libraryObj, episodeObj=episodeObj)
# Enable the transcript menu item options
self.MenuWindow.SetTranscriptOptions(True)
if TransanaConstants.USESRTC:
# After two seconds, call the EditorPaint method of the Transcript Dialog (in the TranscriptionUI_RTC file)
# This causes improperly placed line numers to "correct" themselves!
wx.CallLater(2000, self.TranscriptWindow.dlg.EditorPaint, None)
# Set focus to the new Transcript's Editor (so that CommonKeys work on the Mac)
self.TranscriptWindow.dlg.editor.SetFocus()
# If the video won't load ...
else:
# Clear the interface!
self.ClearAllWindows(clearAllPanes=True)
# We only want to load the File Manager in the Single User version. It's not the appropriate action
# for the multi-user version!
if TransanaConstants.singleUserVersion:
# Open the File Management Window just as if the Menu Item was selected, which
# doesn't cause menu problems on OS X
self.MenuWindow.OnFileManagement(None)
def GetCurrentItemType(self):
""" Report whether the currently-selected Item is None (nothing loaded), a Document, or a Transcript """
# If no object is loaded in the Transcript Window ...
if self.TranscriptWindow.dlg.editor.TranscriptObj is None:
# ... we have nothing
return None
# If the currently-selected object is a Document ...
elif isinstance(self.TranscriptWindow.dlg.editor.TranscriptObj, Document.Document):
# ... we have a Document
return 'Document'
# If the currently-selected object is a Transcript ...
elif isinstance(self.TranscriptWindow.dlg.editor.TranscriptObj, Transcript.Transcript):
# ... we have a Transcript
return 'Transcript'
# If the currently-selected object is a Quote...
elif isinstance(self.TranscriptWindow.dlg.editor.TranscriptObj, Quote.Quote):
# ... we have a Quote
return 'Quote'
def LoadQuote(self, quote_number):
""" When a Quote is identified to trigger systemic loading of all related information,
this method should be called so that all Transana Objects are set appropriately. """
# Initialize a variable indicating if we found the requested Quote
quoteFound = False
# First, see if the selected Quote is already loaded! Iterate through the TranscriptWindow's Notebook Tabs ...
for y in range(self.TranscriptWindow.nb.GetPageCount()):
for pane in self.TranscriptWindow.nb.GetPage(y).GetChildren():
# ... and get a pointer to the tab's active Splitter panel's editor's data object
dataObj = pane.editor.TranscriptObj
# If the data object is not None, then something IS loaded
if dataObj is not None:
# If the data object is a Quote not a Transcript) and the Quote has the same NUMBER ...
if isinstance(dataObj, Quote.Quote) and (quote_number == dataObj.number):
# ... then the requested Quote is already open. Select its Notebook Page ...
self.TranscriptWindow.nb.SetSelection(y)
# ... and select the correct Splitter Pane as the "Active" pane.
self.TranscriptWindow.nb.GetCurrentPage().ActivatePanel(pane.panelNum)
# Note that the quote was found
quoteFound = True
# We can stop looking now
break
# If the requested document was not found ...
if not quoteFound:
# Load the Quote
tmpQuote = Quote.Quote(quote_number)
# If the current Transcript Window's Notebook Page is NOT empty ...
if (self.TranscriptWindow.dlg.editor.TranscriptObj != None):
# ... create a new Notebook Page for the Quote
self.TranscriptWindow.AddNotebookPage(tmpQuote.id)
# Select the new page as the current page
self.TranscriptWindow.nb.SetSelection(self.TranscriptWindow.nb.GetPageCount() - 1)
# If the current Document Window's Notebook Page IS empty ...
else:
self.TranscriptWindow.nb.SetPageText(self.TranscriptWindow.nb.GetSelection(), tmpQuote.id)
# Load the Quote into the Editor Interface (Transcripts, Documents, and Quotes act the same here!)
self.TranscriptWindow.LoadTranscript(tmpQuote)
## # Remove any tabs in the Data Window beyond the Database Tab
## self.DataWindow.DeleteTabs()
##
## # Load the data object's Library
## tmpCollection = Collection.Collection(tmpQuote.collection_num)
## # Add the Keyword Tab to the DataWindow
## self.DataWindow.AddKeywordsTab(collectionObj = tmpCollection, quoteObj = tmpQuote)
##
## # Set the new Current Object
## self.currentObj = tmpQuote
## # Set the Visualization Window's Visualization Object
## self.VisualizationWindow.SetVisualizationObject(tmpQuote)
##
# Enable the transcript menu item options
self.MenuWindow.SetTranscriptOptions(True)
# Update the Transana Interface for this object
self.UpdateCurrentObject(tmpQuote)
# Get the current selection(s) from the Database Tree
selItems = self.DataWindow.DBTab.tree.GetSelections()
# If there are one or more items selected ...
if len(selItems) >= 1:
# ... get the item data from the first selection
selData = self.DataWindow.DBTab.tree.GetPyData(selItems[0])
# If NO items are selected ...
else:
# ... then there's no item data to get
selData = None
# If no items are selected or the item selected is NOT a Search Collection or Search Clip ...
if (selData == None) or not (selData.nodetype in ['SearchCollectionNode', 'SearchClipNode']):
# Let's make sure this clip is displayed in the Database Tree
nodeList = (_('Collections'),) + self.currentObj.GetNodeData()
if isinstance(self.currentObj, Quote.Quote):
# Now point the DBTree (the notebook's parent window's DBTab's tree) to the loaded Quote
self.DataWindow.DBTab.tree.select_Node(nodeList, 'QuoteNode')
def LoadClipByNumber(self, clipNum):
""" When a Clip is identified to trigger systematic loading of all related information,
this method should be called so that all Transana Objects are set appropriately. """
# Load the Clip based on the ClipNumber. (Let's get NotFound exceptions out of the way early!)
clipObj = Clip.Clip(clipNum)
# First, let's see if there's already a video loaded in the system. Iterate through all Notebook Pages.
self.BringTranscriptToFront()
# Before we do anything else, let's save the current transcript if it's been modified.
if self.TranscriptWindow.TranscriptModified():
if TransanaConstants.partialTranscriptEdit:
self.SaveTranscript(1, cleardoc=1, continueEditing=False)
else:
self.SaveTranscript(1, cleardoc=1)
# If the current Editor is a Document (not None, not a Transcript) ...
if isinstance(self.TranscriptWindow.GetCurrentObject(), Document.Document) or \
isinstance(self.TranscriptWindow.GetCurrentObject(), Quote.Quote):
# ... create a new Notebook Page for the Document
self.TranscriptWindow.AddNotebookPage(_("No Document Loaded"))
# Select the new page as the current page
self.TranscriptWindow.nb.SetSelection(self.TranscriptWindow.nb.GetPageCount() - 1)
# If the current Editor is a Transcript (not None, not a Document) ...
elif isinstance(self.TranscriptWindow.GetCurrentObject(), Transcript.Transcript):
# ... then we need to Clear all Windows of media information
self.ClearAllWindows(clearAllPanes=True)
if self.currentObj != None:
# ... create a new Notebook Page for the Document
self.TranscriptWindow.AddNotebookPage(clipObj.id)
# Select the new page as the current page
self.TranscriptWindow.nb.SetSelection(self.TranscriptWindow.nb.GetPageCount() - 1)
# Set the current object to the loaded Clip
self.currentObj = clipObj
# Load the Collection that contains the loaded Clip
collectionObj = Collection.Collection(clipObj.collection_num)
# set the video start and end points to the start and stop points defined in the clip
self.VideoStartPoint = clipObj.clip_start # Set the Video Start Point to the Clip beginning
self.VideoEndPoint = clipObj.clip_stop # Set the Video End Point to the Clip end
# Load the video identified in the Clip
if self.LoadVideo(self.currentObj):
# If we have only one video file ...
if len(self.currentObj.additional_media_files) == 0:
# Identify the loaded media file
prompt = unicode(_('Video Media File: "%s"'), 'utf8')
# Place the file name in the video window's Title bar
self.VideoWindow.SetTitle(prompt % clipObj.media_filename)
# If there are multiple videos ...
else:
# Just label the video window generically. There's not room for file names.
self.VideoWindow.SetTitle(_("Media"))
# Open the first Clip Transcript in Transcript Window (activeTranscript is ALWAYS 0 here!)
self.TranscriptWindow.LoadTranscript(clipObj.transcripts[0])
# Update the Transana Interface for this object
self.UpdateCurrentObject(clipObj.transcripts[0])
# If we allow multiple transcripts ...
if TransanaConstants.proVersion:
# Open the remaining clip transcripts in additional transcript windows.
for tr in clipObj.transcripts[1:]:
self.OpenAdditionalTranscript(tr.number, isEpisodeTranscript=False)
# Delineate the appropriate start and end points for Video Control
self.SetVideoSelection(self.VideoStartPoint, self.VideoEndPoint)
# For reasons I have not been able to track down, when you load a Collection Report, then
# use Hyperlink to open a Quote, then use Hyperlink to open a Clip, currentObj gets wiped out!
# This replaces it (again). I've run the debugger, and the currentObj disappears in a place
# that makes *NO* sense at all. I'm baffled.
if (self.currentObj == None) and (clipObj != None):
self.currentObj = clipObj
## # Remove any tabs in the Data Window beyond the Database Tab. (This was moved down to late in the
## # process due to problems on the Mac documented in the DataWindow object.)
## self.DataWindow.DeleteTabs()
## # Add the Keyword Tab to the DataWindow
## self.DataWindow.AddKeywordsTab(collectionObj=collectionObj, clipObj=clipObj)
##
## # Get the current selection(s) from the Database Tree
## selItems = self.DataWindow.DBTab.tree.GetSelections()
## # If there are one or more items selected ...
## if len(selItems) >= 1:
## # ... get the item data from the first selection
## selData = self.DataWindow.DBTab.tree.GetPyData(selItems[0])
## # If NO items are selected ...
## else:
## # ... then there's no item data to get
## selData = None
##
## # If no items are selected or the item selected is NOT a Search Collection or Search Clip ...
## if (selData == None) or not (selData.nodetype in ['SearchCollectionNode', 'SearchClipNode']):
## # Let's make sure this clip is displayed in the Database Tree
## nodeList = (_('Collections'),) + self.currentObj.GetNodeData()
## if isinstance(self.currentObj, Clip.Clip):
## # Now point the DBTree (the notebook's parent window's DBTab's tree) to the loaded Clip
## self.DataWindow.DBTab.tree.select_Node(nodeList, 'ClipNode')
# Enable the transcript menu item options
self.MenuWindow.SetTranscriptOptions(True)
return True
else:
# Remove any tabs in the Data Window beyond the Database Tab
self.DataWindow.DeleteTabs()
# We only want to load the File Manager in the Single User version. It's not the appropriate action
# for the multi-user version!
if TransanaConstants.singleUserVersion:
# Create a File Management Window
fileManager = FileManagement.FileManagement(self.MenuWindow, -1, _("Transana File Management"))
# Set up, display, and process the File Management Window
fileManager.Setup(showModal=True)
# Destroy the File Manager window
fileManager.Destroy()
return False
def LocateQuoteInDocument(self, quoteNum):
""" Locate the specificed Quote in its source Document, if possible """
# Load the Quote
quote = Quote.Quote(quoteNum)
try:
# If the Source Document is known ...
if quote.source_document_num > 0:
# Load the Document
document = Document.Document(quote.source_document_num)
# Load the Library
library = Library.Library(document.library_num)
# Load the document into the TranscriptWindow via the ControlObject
self.LoadDocument(library.id, document.id, quote.source_document_num)
# Highlight the Quote's text
self.HighlightQuoteInCurrentDocument(quote)
else:
msg = _('The Document this Quote was created from cannot be loaded.\nMost likely, the source Document has been deleted.')
dlg = Dialogs.ErrorDialog(None, msg)
result = dlg.ShowModal()
dlg.Destroy()
except TransanaExceptions.RecordNotFoundError, e:
msg = _('The Document this Quote was created from cannot be loaded.\nMost likely, the source Document has been deleted.')
dlg = Dialogs.ErrorDialog(None, msg)
result = dlg.ShowModal()
dlg.Destroy()
def LocateClipInEpisode(self, clipNum):
""" Locate the specified Clip in its source Episode, if possible """
# Load the Clip. We DO need the Clip Transcript(s) here
clip = Clip.Clip(clipNum)
# We need to track what this clip's source transcripts are.
# Initialize a list to store them.
sourceTranscripts = []
# For each clip transcripts ...
for tr in clip.transcripts:
# ... add that transcript's source transcript to the list
sourceTranscripts.append(tr.source_transcript)
# Start exception handling to catch failures due to orphaned clips
try:
# Load the Episode
episode = Episode.Episode(clip.episode_num)
# If all source transcripts are KNOWN ...
if not 0 in sourceTranscripts:
# ... load the SOURCE transcript for the first Clip Transcript
# To save time here, we can skip loading the actual transcript text, which can take time once we start dealing with images!
transcript = Transcript.Transcript(clip.transcripts[0].source_transcript, skipText=True)
# If any of the transcripts are orphans ...
else:
## # Get the list of possible replacement source transcripts
## transcriptList = DBInterface.list_transcripts(episode.series_id, episode.id)
## # If only 1 transcript is in the list ...
## if len(transcriptList) == 1:
## # ... use that.
## transcript = Transcript.Transcript(transcriptList[0][0])
## # If there are NO transcripts (perhaps because the Episode is gone, perhaps because it has no Transcripts) ...
## elif len(transcriptList) == 0:
## # ... raise an exception. We can't locate a transcript if the Episode is gone or if it has no Transcripts.
## raise RecordNotFoundError ('Transcript', 0)
## # If there are multiple transcripts to choose from ...
## else:
## # Initialize a list
## strList = []
## # Iterate through the list of transcripts ...
## for (transcriptNum, transcriptID, episodeNum) in transcriptList:
## # ... and extract the Transcript IDs
## strList.append(transcriptID)
## # Create a dialog where the user can choose one Transcript
## dlg = wx.SingleChoiceDialog(self, _('Transana cannot identify the Transcript where this clip originated.\nPlease select the Transcript that was used to create this Clip.'),
## _('Transana Information'), strList, wx.OK | wx.CANCEL)
## # Show the dialog. If the user presses OK ...
## if dlg.ShowModal() == wx.ID_OK:
## # ... use the selected transcript
## transcript = Transcript.Transcript(dlg.GetStringSelection(), episode.number)
## # If the user presses Cancel (Esc, etc.) ...
## else:
# ... raise an exception
raise RecordNotFoundError ('Transcript', 0)
# Set the active transcript to 0 so the whole interface will be reset
self.activeTranscript = 0
# Load the source Transcript
self.LoadTranscript(episode.series_id, episode.id, transcript.id)
# Check to see if the load succeeded before continuing!
if self.currentObj != None:
# We need to signal that the Visualization needs to be re-drawn.
self.ChangeVisualization()
# For each Clip transcript except the first one (which has already been loaded) ...
for tr in clip.transcripts[1:]:
# ... load the source Transcript as an Additional Transcript
self.OpenAdditionalTranscript(tr.source_transcript)
# Mark the Clip as the current selection. (This needs to be done AFTER all transcripts have been opened.)
self.SetVideoSelection(clip.clip_start, clip.clip_stop)
# We need the screen to update here, before the next step.
wx.Yield()
# Now let's go through each Transcript Window ...
for trWin in self.TranscriptWindow.nb.GetCurrentPage().GetChildren():
# ... move the cursor to the TRANSCRIPT's Start Time (not the Clip's)
trWin.editor.scroll_to_time(clip.transcripts[trWin.panelNum].clip_start + 10)
# .. and select to the TRANSCRIPT's End Time (not the Clip's)
trWin.editor.select_find(str(clip.transcripts[trWin.panelNum].clip_stop))
# update the selection text
wx.CallLater(50, trWin.editor.ShowCurrentSelection)
except:
(exctype, excvalue, traceback) = sys.exc_info()
if DEBUG:
print exctype, excvalue
import traceback
traceback.print_exc(file=sys.stdout)
if len(clip.transcripts) == 1:
msg = _('The Transcript this Clip was created from cannot be loaded.\nMost likely, the transcript has been deleted.')
else:
msg = _('One of the Transcripts this Clip was created from cannot be loaded.\nMost likely, the transcript has been deleted.')
self.ClearAllWindows(clearAllPanes=True)
dlg = Dialogs.ErrorDialog(None, msg)
result = dlg.ShowModal()
dlg.Destroy()
def BringTranscriptToFront(self):
""" The Document Window can contain MANY document tabs, but only one Transcript tab. Find the Transcript and bring
it to the front. """
# Pass this along to the TranscriptWindow
self.TranscriptWindow.BringTranscriptToFront()
# Update the Current Object
if isinstance(self.TranscriptWindow.dlg.editor.TranscriptObj, Transcript.Transcript):
if self.TranscriptWindow.dlg.editor.TranscriptObj.clip_num == 0:
self.currentObj = Episode.Episode(self.TranscriptWindow.dlg.editor.TranscriptObj.episode_num)
else:
# If a Clip that is open on this computer is being deleted on another computer, an RecordNotFoundError exception
# will be raised here.
try:
self.currentObj = Clip.Clip(self.TranscriptWindow.dlg.editor.TranscriptObj.clip_num)
except TransanaExceptions.RecordNotFoundError, e:
self.currentObj = None
if self.currentObj != None:
# Signal to update Transana's GUI based on this Notebook change
self.UpdateCurrentObject(self.currentObj)
else:
self.currentObj = None
def GetCurrentDocumentObject(self):
""" Get the object underlying the currently-open tab in the Document Window """
return self.TranscriptWindow.dlg.editor.TranscriptObj
def GetOpenDocumentObject(self, docType, docNum):
""" if the Document indicated by docNum is currently open, return a pointer to that existing Document
object. OBJECTS OBTAINED THIS WAY SHOULD NOT BE EDITED!! """
# Set the default result to None, expecting that the object in question will NOT be found.
result = None
# For each Notebook Page in the Transcript Window ...
for page in range(self.TranscriptWindow.nb.GetPageCount()):
# ... for each Splitter Pane on the Notebook Page ...
for pane in self.TranscriptWindow.nb.GetPage(page).GetChildren():
# Get the pane's data object
dataObj = pane.editor.TranscriptObj
if isinstance(dataObj, docType) and (dataObj.number == docNum):
result = dataObj
break
# Return the result
return result
def SelectOpenDocumentTab(self, docType, docNum):
""" Bring the indicated Document / Transcript to the front of the Document Window display """
# Create a flag for when we can stop looking
found = False
# For each Notebook Page in the Transcript Window ...
for page in range(self.TranscriptWindow.nb.GetPageCount()):
# ... for each Splitter Pane on the Notebook Page ...
for pane in self.TranscriptWindow.nb.GetPage(page).GetChildren():
# Get the pane's data object
dataObj = pane.editor.TranscriptObj
# If this is the data object we are looking for ...
if isinstance(dataObj, docType) and (dataObj.number == docNum):
# ... select the appropriate notebook tab ...
self.TranscriptWindow.nb.SetSelection(page)
# .. and the correct Splitter pane ...
pane.ActivatePanel()
# ... signal that we are done ...
found = True
# ... and stop looking at Panes
break
# If we found what we are looking for, we can stop looking at Notebook Tabs too.
if found:
break
def CloseOpenTranscriptWindowObject(self, docType, docNum):
""" If the Document/Transcript/Quote indicated by docNum is currently open, close it.
This is used as part of DELETING an object, and adjustments to child objects are
also made here. """
# For each Notebook Page in the Transcript Window ... (Count DOWN to avoid an error when a Notebook page is closed!
for page in range(self.TranscriptWindow.nb.GetPageCount() - 1, -1, -1):
# If we're dealing with a Clip ... (Clips are different than other types of objects!)
if (docType == Clip.Clip):
# For Clips, we ALWAYS close the whole Notebook Page, even if there are multiple transcripts.
#
# If we have a Transcript ...
# Get the FIRST pane's data object (as they will all have the same clip_num!)
dataObj = self.TranscriptWindow.nb.GetPage(page).GetChildren()[0].editor.TranscriptObj
if isinstance(dataObj, Transcript.Transcript):
# If the Clip Transcript's Clip Number matches the docNum ...
if dataObj.clip_num == docNum:
if self.TranscriptWindow.nb.GetPageCount() > 1:
self.BringTranscriptToFront()
# Unload the Media File
self.ClearAllWindows(clearAllPanes=True)
# ... we can delete the Notebook Page
# self.TranscriptWindow.nb.DeleteNotebookPage(page)
else:
# ... we need to clear the Pane rather than delete it.
self.ClearAllWindows(True)
# If we're dealing with any other object type ...
else:
# ... for each Splitter Pane on the Notebook Page ...
for pane in self.TranscriptWindow.nb.GetPage(page).GetChildren():
# Get the pane's data object
dataObj = pane.editor.TranscriptObj
# If we are deleting a Document, we need to remove the source_document_num from any open Quotes
# taken from that document. (If the object was subsequently edited, the source_document_num could
# be incorrectly restored otherwise.)
#
# Detect if we have a Source Document and a Quote Object
if (docType == Document.Document) and isinstance(dataObj, Quote.Quote):
# If this Quote is taken from THIS Document ...
if dataObj.source_document_num == docNum:
# ... clear the source document number to orphan the Quote
dataObj.source_document_num = 0
# If we have the correct Object Type and the correct Object Number ...
if isinstance(dataObj, docType) and (dataObj.number == docNum):
# If the Document has been edited ...
if pane.editor.modified:
# Bring the Document to the front. (SaveTranscript only works on the current Page)
self.TranscriptWindow.nb.SetSelection(page)
# Save it (with Prompting!)
self.SaveTranscript(1, transcriptToSave=pane.panelNum)
# If there's more than one Splitter Pane open ...
if len(self.TranscriptWindow.nb.GetPage(page).GetChildren()) > 1:
# Clear the Splitter Pane
self.ClearAllWindows()
# ... we can just delete the Splitter Pane
# REDUNDANT! pane.parent.DeletePanel(pane.panelNum)
# Otherwise, if there's more than one Notebook Page open ...
elif self.TranscriptWindow.nb.GetPageCount() > 1:
# Clear the Notebook Page
# self.ClearAllWindows()
# ... we can delete the Notebook Page
self.TranscriptWindow.nb.DeleteNotebookPage(page)
# If there's only one Notebook Page and it has only one Splitter Pane ...
else:
# ... we need to clear the Pane rather than delete it.
self.ClearAllWindows(True)
# If we've just closed a Transcript ...
if docType == Transcript.Transcript:
# ... reset the ControlObject TranscriptNum dictionary
self.TranscriptNum = {}
def UpdateCurrentObject(self, currentObj):
""" This should be called any time the "current" object is changes, such as when the Transcript Notebook Page
is changed. """
# Start exception handling to catch when the current object has been deleted by another user
try:
# If the current Object is a Document ...
if isinstance(currentObj, Document.Document):
# ... load the Library ...
tmpLibrary = Library.Library(currentObj.library_num)
# ... set the Transcript Window title accordingly ...
self.TranscriptWindow.SetTitle(_('Document').decode('utf8') + u' - ' + tmpLibrary.id + u' > ' + currentObj.id)
# ... and set the object to work with to the original Document
tmpCurrentObj = currentObj
# If we have a Episode Object ...
elif isinstance(currentObj, Episode.Episode):
# We already have an episode, so use that.
tmpEpisode = currentObj
# ... load the Library ...
tmpLibrary = Library.Library(tmpEpisode.series_num)
# ... and we'll work with the Episode
tmpCurrentObj = currentObj
# If we have a Transcript Object ... (SHOULD THIS EVEN HAPPEN??)
elif (isinstance(currentObj, Transcript.Transcript) and (currentObj.clip_num == 0)):
# ... load the Episode ...
tmpEpisode = Episode.Episode(currentObj.episode_num)
# ... load the Library ...
tmpLibrary = Library.Library(tmpEpisode.series_num)
# ... and set the object to work with to the EPISODE
tmpCurrentObj = tmpEpisode
# ... set the Transcript Window title accordingly ...
prompt = unicode('%s - %s > %s > %s', 'utf8')
self.TranscriptWindow.SetTitle(prompt % (_('Transcript').decode('utf8'), tmpLibrary.id, tmpEpisode.id, currentObj.id))
elif isinstance(currentObj, Quote.Quote):
# ... set the Transcript Window title accordingly ...
self.TranscriptWindow.SetTitle(_('Quote').decode('utf8') + u' - ' + currentObj.GetNodeString(True))
# ... and set the object to work with to the original Document
tmpCurrentObj = currentObj
elif isinstance(currentObj, Clip.Clip):
# ... set the Transcript Window title accordingly ...
self.TranscriptWindow.SetTitle(_('Clip').decode('utf8') + u' - ' + currentObj.GetNodeString(True))
# ... and set the object to work with to the original Clip
tmpCurrentObj = currentObj
elif isinstance(currentObj, Transcript.Transcript) and (currentObj.clip_num > 0):
try:
# ... load the Clip ...
tmpClip = Clip.Clip(currentObj.clip_num)
# ... and set the object to work with to the CLIP
tmpCurrentObj = tmpClip
# ... set the Transcript Window title accordingly ...
self.TranscriptWindow.SetTitle(_('Clip').decode('utf8') + u' - ' + tmpClip.GetNodeString(True))
except TransanaExceptions.RecordNotFoundError, e:
# If the record is not found, that's because ANOTHER USER has deleted it!!
# We have to fake it here!
tmpCurrentObj = Clip.Clip()
tmpCurrentObj.number = currentObj.clip_num
else:
tmpCurrentObj = currentObj
print "ControlObjectClass.UpdateCurrentObject():", self.currentObj == currentObj
print type(self.currentObj), type(currentObj)
print currentObj
print
# If the current object is not found,
except TransanaExceptions.RecordNotFoundError, e:
# The current object has been deleted, so signal that!
tmpCurrentObj = None
# Remove any tabs in the Data Window beyond the Database Tab
self.DataWindow.DeleteTabs()
# This method can have problems during MU object deletion. Therefore, start exception handling.
try:
if tmpCurrentObj == None:
pass
elif isinstance(tmpCurrentObj, Document.Document):
tmpLibrary = Library.Library(tmpCurrentObj.library_num)
# Add the Document Quotes Tab to the DataWindow
self.DataWindow.AddItemsTab(libraryObj=tmpLibrary, dataObj=tmpCurrentObj)
# Add the Selected Document Quotes Tab to the DataWindow
self.DataWindow.AddSelectedItemsTab(libraryObj=tmpLibrary, dataObj=tmpCurrentObj,
textPos=self.TranscriptWindow.dlg.editor.GetCurrentPos(),
textSel=self.TranscriptWindow.dlg.editor.GetSelection())
# Add the Keyword Tab to the DataWindow
self.DataWindow.AddKeywordsTab(seriesObj = tmpLibrary, documentObj = tmpCurrentObj)
# Set the Visualization Window's Visualization Object
self.VisualizationWindow.SetVisualizationObject(tmpCurrentObj)
elif isinstance(tmpCurrentObj, Episode.Episode):
# Add the Episode Clips Tab to the DataWindow
self.DataWindow.AddItemsTab(libraryObj = tmpLibrary, dataObj = tmpEpisode)
# Add the Selected Episode Clips Tab to the DataWindow
self.DataWindow.AddSelectedItemsTab(libraryObj = tmpLibrary, dataObj = tmpEpisode, timeCode=self.GetVideoPosition())
# Add the Keyword Tab to the DataWindow
self.DataWindow.AddKeywordsTab(seriesObj = tmpLibrary, episodeObj = tmpEpisode)
# For reasons that elude me, "if self.currentObj != tmpCurrentObj" didn't work, but this does!
# If we're changing the underlying object ...
if (type(self.currentObj) != type(tmpCurrentObj)) or (self.currentObj.number != tmpCurrentObj.number):
# Set the Visualization Window's Visualization Object
self.VisualizationWindow.SetVisualizationObject(tmpEpisode)
elif isinstance(tmpCurrentObj, Quote.Quote):
tmpCollection = Collection.Collection(tmpCurrentObj.collection_num)
# Add the Keyword Tab to the DataWindow
self.DataWindow.AddKeywordsTab(collectionObj = tmpCollection, quoteObj = tmpCurrentObj)
# Set the Visualization Window's Visualization Object
self.VisualizationWindow.SetVisualizationObject(tmpCurrentObj)
elif isinstance(tmpCurrentObj, Clip.Clip):
tmpCollection = Collection.Collection(tmpCurrentObj.collection_num)
# Add the Keyword Tab to the DataWindow
self.DataWindow.AddKeywordsTab(collectionObj = tmpCollection, clipObj = tmpCurrentObj)
# For reasons that elude me, "if self.currentObj != tmpCurrentObj" didn't work, but this does!
# If we're changing the underlying object ...
# Add check of VisualizationWindow's current type because if you hit PLAY with a Document or Quote
# selected and a Clip in the background, the visualization wasn't updating correctly!!
if (type(self.currentObj) != type(tmpCurrentObj)) or (self.currentObj.number != tmpCurrentObj.number) or \
(type(self.currentObj) != (type(self.VisualizationWindow.VisualizationObject))):
# Set the Visualization Window's Visualization Object
self.VisualizationWindow.SetVisualizationObject(tmpCurrentObj)
else:
print "ControlObjectClass.UpdateCurrentObject(): %s not implemented." % type(tmpCurrentObj)
# If we can't find a record to load the appropriate object, it's probably been deleted by another user.
except TransanaExceptions.RecordNotFoundError, e:
# print "ControlObjectClass.UpdateCurrentObject(): ", type(tmpCurrentObj), tmpCurrentObj.id
# print sys.exc_info()[0]