~ubuntu-branches/ubuntu/maverick/svn-workbench/maverick

« back to all changes in this revision

Viewing changes to Source/wb_frame.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-07-30 23:33:06 UTC
  • mfrom: (2.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080730233306-f4radlcg6d8dr9k8
Tags: 1.5.4-2
Fix wx import. Closes: #492605.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
'''
2
2
 ====================================================================
3
 
 Copyright (c) 2003-2006 Barry A Scott.  All rights reserved.
 
3
 Copyright (c) 2003-2007 Barry A Scott.  All rights reserved.
4
4
 
5
5
 This software is licensed as described in the file LICENSE.txt,
6
6
 which you should have received as part of this distribution.
29
29
 
30
30
import wb_config
31
31
 
32
 
# point size and face need to choosen for platform
33
 
if wx.Platform == '__WXMSW__':
34
 
    face = 'Courier New'
35
 
    point_size = 8
36
 
elif wx.Platform == '__WXMAC__':
37
 
    face = 'Monaco'
38
 
    point_size = 12
39
 
else:
40
 
    face = 'Courier'
41
 
    point_size = 12
42
 
 
43
32
class WbFrame(wx.Frame):
44
33
    status_general = 0
45
34
    status_search = 0    # use the general area
46
35
    status_progress = 1
47
36
    status_action = 2
48
37
    status_num_fields = 3
49
 
    status_widths = [-1, 100, -2]
 
38
    status_widths = [-1, 150, -2]
50
39
 
51
40
    def __init__( self, app ):
52
41
        self.app = app
53
 
        title = 'Work Bench'
 
42
        title = T_('PySVN WorkBench')
54
43
 
55
44
        win_prefs = self.app.prefs.getWindow()
56
45
 
57
46
        extra_style = 0
58
47
        if win_prefs.maximized:
59
48
            extra_style = wx.MAXIMIZE
 
49
 
60
50
        wx.Frame.__init__(self, None, -1, title,
61
51
                win_prefs.frame_position,
62
52
                win_prefs.frame_size,
63
53
                wx.DEFAULT_FRAME_STYLE|extra_style )
64
54
 
 
55
        # Reset the size after startup to workaround a potential
 
56
        # problem on OSX with incorrect first size event saving the
 
57
        # wrong size in teh preferences
 
58
        wx.CallAfter(self.SetSize, win_prefs.frame_size)
 
59
        
65
60
        self.menu_edit = wx.Menu()
66
 
        self.menu_edit.Append( wb_ids.id_SP_EditCopy, "&Copy", "Copy Files" )
67
 
        self.menu_edit.Append( wb_ids.id_SP_EditCut, "&Cut", "Cut Files" )
68
 
        self.menu_edit.Append( wb_ids.id_SP_EditPaste, "&Paste", "Paste Files" )
 
61
        self.menu_edit.Append( wb_ids.id_SP_EditCopy, T_("&Copy"), T_("Copy Files") )
 
62
        self.menu_edit.Append( wb_ids.id_SP_EditCut, T_("&Cut"), T_("Cut Files") )
 
63
        self.menu_edit.Append( wb_ids.id_SP_EditPaste, T_("&Paste"), T_("Paste Files") )
69
64
        self.menu_edit.AppendSeparator()
70
 
        self.menu_edit.Append( wb_ids.id_ClearLog, "&Clear log", "Clear the log window" )
 
65
        self.menu_edit.Append( wb_ids.id_ClearLog, T_("&Clear log"), T_("Clear the log window") )
71
66
 
72
67
        if wx.Platform != '__WXMAC__':
73
68
            self.menu_file = wx.Menu()
74
69
        else:
75
70
            self.menu_file = self.menu_edit
76
71
 
77
 
        self.menu_file.Append( wx.ID_PREFERENCES, "&Preferences...", "Preferences" )
78
 
        self.menu_file.Append( wx.ID_EXIT, "E&xit", "Exit the application" )
 
72
        self.menu_file.Append( wx.ID_PREFERENCES, T_("&Preferences..."), T_("Preferences") )
 
73
        self.menu_file.Append( wx.ID_EXIT, T_("E&xit"), T_("Exit the application") )
79
74
 
80
75
        self.menu_actions = wx.Menu()
81
 
        self.menu_actions.Append(  wb_ids.id_Command_Shell, '&Command Shell', 'Command Shell' )
82
 
        self.menu_actions.Append(  wb_ids.id_File_Browser, '&File Browser', 'File Browser' )
83
 
        self.menu_actions.AppendSeparator()
84
 
        self.menu_actions.Append(  wb_ids.id_File_Edit, 'Edit', 'Edit' )
85
 
        self.menu_actions.Append(  wb_ids.id_Shell_Open, 'Open', 'Open' )
86
 
        self.menu_actions.AppendSeparator()
87
 
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkBase, 'Diff WC vs. BASE...', 'Diff WC vs. BASE...' )
88
 
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkHead, 'Diff WC vs. HEAD...', 'Diff WC vs. HEAD...' )
89
 
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkBranchOriginBase, 'Diff WC vs. branch origin BASE...', 'Diff WC vs. branch origin BASE...' )
90
 
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkBranchOriginHead, 'Diff WC vs. branch origin HEAD...', 'Diff WC vs. branch origin HEAD...' )
 
76
        self.menu_actions.Append(  wb_ids.id_Command_Shell, T_('&Command Shell'), T_('Command Shell') )
 
77
        self.menu_actions.Append(  wb_ids.id_File_Browser, T_('&File Browser'), T_('File Browser') )
 
78
        self.menu_actions.AppendSeparator()
 
79
        self.menu_actions.Append(  wb_ids.id_File_Edit, T_('Edit'), T_('Edit') )
 
80
        self.menu_actions.Append(  wb_ids.id_Shell_Open, T_('Open'), T_('Open') )
 
81
        self.menu_actions.AppendSeparator()
 
82
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkBase, T_('Diff WC vs. BASE...'), T_('Diff WC vs. BASE...') )
 
83
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkHead, T_('Diff WC vs. HEAD...'), T_('Diff WC vs. HEAD...') )
 
84
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkBranchOriginBase, T_('Diff WC vs. branch origin BASE...'), T_('Diff WC vs. branch origin BASE...') )
 
85
        self.menu_actions.Append(  wb_ids.id_SP_DiffWorkBranchOriginHead, T_('Diff WC vs. branch origin HEAD...'), T_('Diff WC vs. branch origin HEAD...') )
91
86
 
92
87
        self.menu_actions_conflict = wx.Menu()
93
 
        self.menu_actions.AppendMenu( wb_ids.id_SP_ConflictMenu, 'Conflict', self.menu_actions_conflict )
94
 
        self.menu_actions_conflict.Append( wb_ids.id_SP_DiffOldMine, 'Diff Conflict Old vs. Mine...', 'Diff Conflict Old vs. Mine...' )
95
 
        self.menu_actions_conflict.Append( wb_ids.id_SP_DiffMineNew, 'Diff Conflict Mine vs. New...', 'Diff Conflict Mine vs. New...' )
96
 
        self.menu_actions_conflict.Append( wb_ids.id_SP_DiffOldNew, 'Diff Conflict Old vs. New...', 'Diff Conflict Old vs. New...' )
 
88
        self.menu_actions.AppendMenu( wb_ids.id_SP_ConflictMenu, T_('Conflict'), self.menu_actions_conflict )
 
89
        self.menu_actions_conflict.Append( wb_ids.id_SP_DiffOldMine, T_('Diff Conflict Old vs. Mine...'), T_('Diff Conflict Old vs. Mine...') )
 
90
        self.menu_actions_conflict.Append( wb_ids.id_SP_DiffMineNew, T_('Diff Conflict Mine vs. New...'), T_('Diff Conflict Mine vs. New...') )
 
91
        self.menu_actions_conflict.Append( wb_ids.id_SP_DiffOldNew, T_('Diff Conflict Old vs. New...'), T_('Diff Conflict Old vs. New...') )
97
92
        self.menu_actions_conflict.AppendSeparator()
98
 
        self.menu_actions_conflict.Append( wb_ids.id_SP_Resolved, 'Resolved Conflict', 'Resolved Conflict' )
 
93
        self.menu_actions_conflict.Append( wb_ids.id_SP_Resolved, T_('Resolved Conflict'), T_('Resolved Conflict') )
99
94
 
100
95
        self.menu_actions.AppendSeparator()
101
 
        self.menu_actions.Append( wb_ids.id_SP_Annotate, 'Annotate...', 'Annotate...' )
102
 
        self.menu_actions.Append( wb_ids.id_SP_History, 'Log history...', 'Log history...' )
103
 
        self.menu_actions.Append( wb_ids.id_SP_Info, 'Information...', 'Information...' )
104
 
        self.menu_actions.Append( wb_ids.id_SP_Properties, 'Properties...', 'Properties...' )
105
 
        self.menu_actions.AppendSeparator()
106
 
        self.menu_actions.Append( wb_ids.id_SP_Update, 'Update', 'Update' )
107
 
        self.menu_actions.Append( wb_ids.id_SP_Checkout, 'Checkout', 'Checkout' )
108
 
        self.menu_actions.AppendSeparator()
109
 
        self.menu_actions.Append( wb_ids.id_SP_Checkin, 'Checkin...', 'Checkin...' )
110
 
        self.menu_actions.AppendSeparator()
111
 
        self.menu_actions.Append( wb_ids.id_SP_Lock, 'Lock...', 'Lock...' )
112
 
        self.menu_actions.Append( wb_ids.id_SP_Unlock, 'Unlock...', 'Unlock...' )
113
 
        self.menu_actions.AppendSeparator()
114
 
        self.menu_actions.Append( wb_ids.id_SP_NewFile, 'New File...', 'New File...' )
115
 
        self.menu_actions.Append( wb_ids.id_SP_Mkdir, 'Make directory...', 'Make directory...' )
116
 
        self.menu_actions.Append( wb_ids.id_SP_Add, 'Add', 'Add' )
117
 
        self.menu_actions.Append( wb_ids.id_SP_Rename, 'Rename...', 'Rename' )
118
 
        self.menu_actions.AppendSeparator()
119
 
        self.menu_actions.Append( wb_ids.id_SP_Delete, 'Delete...', 'Delete' )
120
 
        self.menu_actions.Append( wb_ids.id_SP_Revert, 'Revert...', 'Revert' )
121
 
        self.menu_actions.AppendSeparator()
122
 
        self.menu_actions.Append( wb_ids.id_SP_Cleanup, 'Clean up', 'Clean up working copy' )
 
96
        self.menu_actions.Append( wb_ids.id_SP_Annotate, T_('Annotate...'), T_('Annotate...') )
 
97
        self.menu_actions.Append( wb_ids.id_SP_History, T_('Log history...'), T_('Log history...') )
 
98
        self.menu_actions.Append( wb_ids.id_SP_Info, T_('Information...'), T_('Information...') )
 
99
        self.menu_actions.Append( wb_ids.id_SP_Properties, T_('Properties...'), T_('Properties...') )
 
100
        self.menu_actions.AppendSeparator()
 
101
        self.menu_actions.Append( wb_ids.id_SP_Update, T_('Update'), T_('Update') )
 
102
        self.menu_actions.Append( wb_ids.id_SP_Checkout, T_('Checkout'), T_('Checkout') )
 
103
        self.menu_actions.AppendSeparator()
 
104
        self.menu_actions.Append( wb_ids.id_SP_Checkin, T_('Checkin...'), T_('Checkin...') )
 
105
        self.menu_actions.AppendSeparator()
 
106
        self.menu_actions.Append( wb_ids.id_SP_Lock, T_('Lock...'), T_('Lock...') )
 
107
        self.menu_actions.Append( wb_ids.id_SP_Unlock, T_('Unlock...'), T_('Unlock...') )
 
108
        self.menu_actions.AppendSeparator()
 
109
        self.menu_actions.Append( wb_ids.id_SP_NewFile, T_('New File...'), T_('New File...') )
 
110
        self.menu_actions.Append( wb_ids.id_SP_Mkdir, T_('Make directory...'), T_('Make directory...') )
 
111
        self.menu_actions.Append( wb_ids.id_SP_Add, T_('Add'), T_('Add') )
 
112
        self.menu_actions.Append( wb_ids.id_SP_Rename, T_('Rename...'), T_('Rename') )
 
113
        self.menu_actions.AppendSeparator()
 
114
        self.menu_actions.Append( wb_ids.id_SP_Delete, T_('Delete...'), T_('Delete') )
 
115
        self.menu_actions.Append( wb_ids.id_SP_Revert, T_('Revert...'), T_('Revert') )
 
116
        self.menu_actions.AppendSeparator()
 
117
        self.menu_actions.Append( wb_ids.id_SP_Cleanup, T_('Clean up'), T_('Clean up working copy') )
 
118
        self.menu_actions.AppendSeparator()
 
119
        self.menu_actions.Append( wb_ids.id_SP_CreateTag, T_('Create Tag...'), T_('Create Tag') )
 
120
        self.menu_actions.Append( wb_ids.id_SP_CreateBranch, T_('Create Branch...'), T_('Create Branch') )
123
121
 
124
122
        self.menu_reports = wx.Menu()
125
 
        self.menu_reports.Append( wb_ids.id_SP_Report_LocksWc, 'Working copy Locks...', 'Locks held in Working Copy' )
126
 
        self.menu_reports.Append( wb_ids.id_SP_Report_LocksRepos, 'Repository Locks...', 'Locks held in Repository' )
 
123
        self.menu_reports.Append( wb_ids.id_SP_Report_LocksWc, T_('Working copy Locks...'), T_('Locks held in Working Copy') )
 
124
        self.menu_reports.Append( wb_ids.id_SP_Report_LocksRepos, T_('Repository Locks...'), T_('Locks held in Repository') )
127
125
        self.menu_reports.AppendSeparator()
128
 
        self.menu_reports.Append( wb_ids.id_SP_Checkin, 'Changes...', 'Changes available for checkin' )
129
 
        self.menu_reports.Append( wb_ids.id_SP_Report_Updates, 'Updates...', 'Updates available in the Repository' )
130
 
        self.menu_reports.Append( wb_ids.id_SP_Report_BranchChanges, 'Branch changes...', 'Files changed in this branch' )
 
126
        self.menu_reports.Append( wb_ids.id_SP_Checkin, T_('Changes...'), T_('Changes available for checkin') )
 
127
        self.menu_reports.Append( wb_ids.id_SP_Report_Updates, T_('Updates...'), T_('Updates available in the Repository') )
 
128
        self.menu_reports.Append( wb_ids.id_SP_Report_BranchChanges, T_('Branch changes...'), T_('Files changed in this branch') )
131
129
 
132
130
        self.menu_view = wx.Menu()
133
 
        self.menu_view.AppendCheckItem( wb_ids.id_View_ControlledFiles, "Show &Controlled files", "Show Controlled files" )
134
 
        self.menu_view.AppendCheckItem( wb_ids.id_View_UncontrolledFiles, "Show &Uncontrolled files", "Show Uncontrolled files" )
135
 
        self.menu_view.AppendCheckItem( wb_ids.id_View_IgnoredFiles, "Show &Ignored files", "Show ignored files" )
136
 
        self.menu_view.AppendSeparator()
137
 
        self.menu_view.AppendCheckItem( wb_ids.id_View_Recursive, "Show &Recursive files", "Show recursive files" )
138
 
        self.menu_view.AppendSeparator()
139
 
        self.menu_view.Append( wb_ids.id_View_Refresh, "&Refresh\tF5", "Refresh display" )
140
 
        self.menu_view.AppendCheckItem( wb_ids.id_View_AutoRefresh, "&Automatic Refresh", "Automatic refresh" )
 
131
        self.menu_view.AppendCheckItem( wb_ids.id_View_ControlledFiles, T_("Show &Controlled files"), T_("Show Controlled files") )
 
132
        self.menu_view.AppendCheckItem( wb_ids.id_View_UncontrolledFiles, T_("Show &Uncontrolled files"), T_("Show Uncontrolled files") )
 
133
        self.menu_view.AppendCheckItem( wb_ids.id_View_IgnoredFiles, T_("Show &Ignored files"), T_("Show ignored files") )
 
134
        self.menu_view.AppendCheckItem( wb_ids.id_View_OnlyChanges, T_("Show &Only changed files"), T_("Filter out unchanged files") )
 
135
        self.menu_view.AppendSeparator()
 
136
        self.menu_view.AppendCheckItem( wb_ids.id_View_Recursive, T_("Show &Recursive files"), T_("Show recursive files") )
 
137
        self.menu_view.AppendSeparator()
 
138
        self.menu_view.AppendCheckItem( wb_ids.id_View_Diff_WbDiff, T_('Use WorkBench Diff') )
 
139
        self.menu_view.AppendCheckItem( wb_ids.id_View_Diff_ExtGuiDiff, T_('Use External GUI Diff') )
 
140
        self.menu_view.AppendCheckItem( wb_ids.id_View_Diff_ExtTextDiff, T_('Use External Text Diff') )
 
141
        self.menu_view.AppendCheckItem( wb_ids.id_View_Diff_SvnDiff, T_('Use SVN Diff') )
 
142
        self.menu_view.AppendSeparator()
 
143
        self.menu_view.Append( wb_ids.id_View_Refresh, T_("&Refresh\tF5"), T_("Refresh display") )
 
144
        self.menu_view.AppendCheckItem( wb_ids.id_View_AutoRefresh, T_("&Automatic Refresh"), T_("Automatic refresh") )
 
145
 
 
146
 
141
147
 
142
148
        self.all_bookmark_ids = {}
143
149
        self.all_bookmark_top_level_menu_ids = []
144
150
        self.all_bookmark_folders = {}
145
151
 
146
152
        self.menu_bookmarks = wx.Menu()
147
 
        self.menu_bookmarks.Append( wb_ids.id_Bookmark_Add, 'Add', 'Add Bookmark' )
148
 
        self.menu_bookmarks.Append( wb_ids.id_Bookmark_Manage, 'Manage...', 'Manage Bookmarks' )
 
153
        self.menu_bookmarks.Append( wb_ids.id_Bookmark_Add, T_('Add'), T_('Add Bookmark') )
 
154
        self.menu_bookmarks.Append( wb_ids.id_Bookmark_Manage, T_('Manage...'), T_('Manage Bookmarks') )
149
155
        self.menu_bookmarks.AppendSeparator()
150
156
 
151
157
        self.__bookmarkMenuReorder()
152
158
 
153
159
        self.menu_project = wx.Menu()
154
 
        self.menu_project.Append( wb_ids.id_Project_Add, 'Add...', 'Project Add' )
155
 
        self.menu_project.Append( wb_ids.id_Project_Update, 'Update...', 'Update Project' )
 
160
        self.menu_project.Append( wb_ids.id_Project_Add, T_('Add...'), T_('Project Add') )
 
161
        self.menu_project.Append( wb_ids.id_Project_Update, T_('Update...'), T_('Update Project') )
156
162
        self.menu_project.AppendSeparator()
157
 
        self.menu_project.Append( wb_ids.id_Project_Delete, 'Delete...', 'Delete Project' )
 
163
        self.menu_project.Append( wb_ids.id_Project_Delete, T_('Delete...'), T_('Delete Project') )
158
164
 
159
165
        self.menu_help = wx.Menu()
160
 
        self.menu_help.Append( wx.ID_ABOUT, "&About...", "About the application" )
 
166
        self.menu_help.Append( wx.ID_ABOUT, T_("&About..."), T_("About the application") )
161
167
 
162
168
        self.menu_bar = wx.MenuBar()
163
169
        if wx.Platform != '__WXMAC__':
164
 
            self.menu_bar.Append( self.menu_file, "&File" )
165
 
        self.menu_bar.Append( self.menu_edit, "&Edit" )
166
 
        self.menu_bar.Append( self.menu_view, "&View" )
167
 
        self.menu_bar.Append( self.menu_actions, "&Actions" )
168
 
        self.menu_bar.Append( self.menu_reports, "&Reports" )
169
 
        self.menu_bar.Append( self.menu_bookmarks, "&Bookmarks" )
170
 
        self.menu_bar.Append( self.menu_project, "&Project" )
171
 
        self.menu_bar.Append( self.menu_help, "&Help" )
 
170
            self.menu_bar.Append( self.menu_file, T_("&File") )
 
171
        self.menu_bar.Append( self.menu_edit, T_("&Edit") )
 
172
        self.menu_bar.Append( self.menu_view, T_("&View") )
 
173
        self.menu_bar.Append( self.menu_actions, T_("&Actions") )
 
174
        self.menu_bar.Append( self.menu_reports, T_("&Reports") )
 
175
        self.menu_bar.Append( self.menu_bookmarks, T_("&Bookmarks") )
 
176
        self.menu_bar.Append( self.menu_project, T_("&Project") )
 
177
        self.menu_bar.Append( self.menu_help, T_("&Help") )
172
178
 
173
179
        self.SetMenuBar( self.menu_bar )
174
180
 
183
189
        t.SetToolBitmapSize( bitmap_size )
184
190
        t.AddSimpleTool( wb_ids.id_SP_EditCut,
185
191
            wb_images.getBitmap( 'toolbar_images/editcut.png', bitmap_size ),
186
 
            'Cut Files and Folders', 'Cut Files and Folders' )
 
192
            T_('Cut Files and Folders'), T_('Cut Files and Folders') )
187
193
        t.AddSimpleTool( wb_ids.id_SP_EditCopy,
188
194
            wb_images.getBitmap( 'toolbar_images/editcopy.png', bitmap_size ),
189
 
            'Copy Files and Folders', 'Copy Files and Folders' )
 
195
            T_('Copy Files and Folders'), T_('Copy Files and Folders') )
190
196
        t.AddSimpleTool( wb_ids.id_SP_EditPaste,
191
197
            wb_images.getBitmap( 'toolbar_images/editpaste.png', bitmap_size ),
192
 
            'Paste Files and Folders', 'Paste Files and Folders' )
 
198
            T_('Paste Files and Folders'), T_('Paste Files and Folders') )
193
199
        t.AddSeparator()
194
200
        t.AddSimpleTool( wb_ids.id_Command_Shell,
195
201
            wb_images.getBitmap( 'toolbar_images/terminal.png', bitmap_size ),
196
 
            'Command Shell', 'Start new command shell' )
 
202
            T_('Command Shell'), T_('Start new command shell') )
197
203
        t.AddSimpleTool( wb_ids.id_File_Browser,
198
204
            wb_images.getBitmap( 'toolbar_images/file_browser.png', bitmap_size ),
199
 
            'File Browser', 'File Browser' )
 
205
            T_('File Browser'), T_('File Browser') )
200
206
        t.AddSeparator()
201
207
        t.AddSimpleTool( wb_ids.id_File_Edit,
202
208
            wb_images.getBitmap( 'toolbar_images/edit.png', bitmap_size ),
203
 
            'Edit File', 'Edit File' )
 
209
            T_('Edit File'), T_('Edit File') )
204
210
        t.AddSimpleTool( wb_ids.id_Shell_Open,
205
211
            wb_images.getBitmap( 'toolbar_images/open.png', bitmap_size ),
206
 
            'Open File', 'Open File' )
 
212
            T_('Open File'), T_('Open File') )
207
213
        t.AddSeparator()
208
214
        t.AddSimpleTool( wb_ids.id_SP_DiffWorkBase,
209
215
            wb_images.getBitmap( 'toolbar_images/diff.png', bitmap_size ),
210
 
            'Diff changes against base', 'Diff changes against base' )
 
216
            T_('Diff changes against base'), T_('Diff changes against base') )
211
217
        t.AddSimpleTool( wb_ids.id_SP_History,
212
218
            wb_images.getBitmap( 'toolbar_images/history.png', bitmap_size ),
213
 
            'Show History log', 'Show History log' )
 
219
            T_('Show History log'), T_('Show History log') )
214
220
        t.AddSimpleTool( wb_ids.id_SP_Info,
215
221
            wb_images.getBitmap( 'toolbar_images/info.png', bitmap_size ),
216
 
            'File Information', 'File Information' )
 
222
            T_('File Information'), T_('File Information') )
217
223
        t.AddSimpleTool( wb_ids.id_SP_Properties,
218
224
            wb_images.getBitmap( 'toolbar_images/property.png', bitmap_size ),
219
 
            'File Properties', 'File Properties' )
 
225
            T_('File Properties'), T_('File Properties') )
220
226
        t.AddSeparator()
221
227
        t.AddSimpleTool( wb_ids.id_SP_Add,
222
228
            wb_images.getBitmap( 'toolbar_images/add.png', bitmap_size ),
223
 
            'Add Files and Folders', 'Add Files and Folders' )
 
229
            T_('Add Files and Folders'), T_('Add Files and Folders') )
224
230
        t.AddSimpleTool( wb_ids.id_SP_Delete,
225
231
            wb_images.getBitmap( 'toolbar_images/delete.png', bitmap_size ),
226
 
            'Delete selected Files and Folders', 'Delete selected Files and Folders' )
 
232
            T_('Delete selected Files and Folders'), T_('Delete selected Files and Folders') )
227
233
        t.AddSimpleTool( wb_ids.id_SP_Revert,
228
234
            wb_images.getBitmap( 'toolbar_images/revert.png', bitmap_size ),
229
 
            'Revert selected Files and Folders', 'Revert selected Files and Folders' )
 
235
            T_('Revert selected Files and Folders'), T_('Revert selected Files and Folders') )
230
236
        t.AddSeparator()
231
237
        t.AddSimpleTool( wb_ids.id_SP_Lock,
232
238
            wb_images.getBitmap( 'toolbar_images/lock.png', bitmap_size ),
233
 
            'Lock File', 'Lock File' )
 
239
            T_('Lock File'), T_('Lock File') )
234
240
        t.AddSimpleTool( wb_ids.id_SP_Unlock,
235
241
            wb_images.getBitmap( 'toolbar_images/unlock.png', bitmap_size ),
236
 
            'Unlock File', 'Unlock File' )
 
242
            T_('Unlock File'), T_('Unlock File') )
237
243
        t.AddSeparator()
238
244
        t.AddSimpleTool( wb_ids.id_SP_Checkin,
239
245
            wb_images.getBitmap( 'toolbar_images/checkin.png', bitmap_size ),
240
 
            'Checkin changes', 'Checkin changes' )
 
246
            T_('Checkin changes'), T_('Checkin changes') )
241
247
        t.AddSimpleTool( wb_ids.id_SP_Update,
242
248
            wb_images.getBitmap( 'toolbar_images/update.png', bitmap_size ),
243
 
            'Update working copy', 'Update working copy' )
 
249
            T_('Update working copy'), T_('Update working copy') )
 
250
        t.AddSeparator()
 
251
        t.AddSimpleTool( wb_ids.id_View_Recursive,
 
252
            wb_images.getBitmap( 'toolbar_images/flatview.png', bitmap_size ),
 
253
            T_('Use recursive (flat) view'), T_('Use recursive (flat) view'),
 
254
            isToggle=True )
 
255
        t.AddSimpleTool( wb_ids.id_View_OnlyChanges,
 
256
            wb_images.getBitmap( 'toolbar_images/onlychanges.png', bitmap_size ),
 
257
            T_('Show only changed files'), T_('Show only changed files'),
 
258
            isToggle=True )
244
259
 
245
260
        t.Realize()
246
261
 
248
263
        s = self.CreateStatusBar()
249
264
        s.SetFieldsCount( WbFrame.status_num_fields )
250
265
        s.SetStatusWidths( WbFrame.status_widths )
251
 
        s.SetStatusText("Work Bench", WbFrame.status_general)
 
266
        s.SetStatusText(T_("Work Bench"), WbFrame.status_general)
252
267
        s.SetStatusText("", WbFrame.status_progress)
253
 
        s.SetStatusText("Ready", WbFrame.status_action)
 
268
        s.SetStatusText(T_("Ready"), WbFrame.status_action)
254
269
        if WbFrame.status_search != WbFrame.status_general:
255
270
            s.SetStatusText("", WbFrame.status_search)
256
271
 
257
272
        # Create the splitter windows
258
 
        self.h_split = wx.SplitterWindow( self, -1 )
259
 
        self.v_split = wx.SplitterWindow( self.h_split, -1 )
 
273
        if 'wxMac' in wx.PlatformInfo:
 
274
            style = wx.SP_LIVE_UPDATE | wx.SP_3DSASH
 
275
        else:
 
276
            style = wx.SP_LIVE_UPDATE
 
277
        self.h_split = wx.SplitterWindow( self, -1, style=style )
 
278
        self.v_split = wx.SplitterWindow( self.h_split, -1, style=style )
260
279
 
261
280
        # Make sure the splitters can't be removed by setting a minimum size
262
281
        self.v_split.SetMinimumPaneSize( 100 )
264
283
 
265
284
        # Create the main panels
266
285
        self.log_panel = LogCtrlPanel( self.app, self.h_split )
 
286
        self.log_panel.SetZoom( win_prefs.zoom )
267
287
        self.list_panel = wb_list_panel.WbListPanel( self.app, self, self.v_split )
268
288
        self.tree_panel = wb_tree_panel.WbTreePanel( self.app, self, self.v_split )
269
289
 
 
290
        # Fixup the tab order that results from creating the tree and
 
291
        # list panels in the wrong order
 
292
        self.list_panel.MoveAfterInTabOrder( self.tree_panel )
 
293
 
270
294
        try_wrapper = wb_exceptions.TryWrapperFactory( self.app.log )
271
295
 
272
296
        size = self.GetClientSize()
273
297
 
274
298
        h_sash_pos = max( 200, int( size.height * win_prefs.h_sash_ratio) )
275
299
        v_sash_pos = max( 200, int( size.width  * win_prefs.v_sash_ratio) )
276
 
 
 
300
        
277
301
        # Arrange the panels with the splitter windows
278
302
        self.v_split.SplitVertically( self.tree_panel, self.list_panel, v_sash_pos )
279
303
        self.h_split.SplitHorizontally( self.v_split, self.log_panel, h_sash_pos )
303
327
            wx.EVT_MENU( event_source, wb_ids.id_View_Recursive, try_wrapper( self.OnToggleViewRecursive ) )
304
328
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_View_Recursive, try_wrapper( self.OnUpdateViewRecursive ) )
305
329
 
 
330
            wx.EVT_MENU( event_source, wb_ids.id_View_OnlyChanges, try_wrapper( self.OnToggleViewOnlyChanges ) )
 
331
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_View_OnlyChanges, try_wrapper( self.OnUpdateViewOnlyChanges ) )
 
332
 
306
333
            wx.EVT_MENU( event_source, wb_ids.id_SP_EditCopy, self.app.eventWrapper( self.OnSpEditCopy ) )
307
334
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_SP_EditCopy, self.app.eventWrapper( self.OnUpdateUiSpEditCopy ) )
308
335
            wx.EVT_MENU( event_source, wb_ids.id_SP_EditCut, self.app.eventWrapper( self.OnSpEditCut ) )
310
337
            wx.EVT_MENU( event_source, wb_ids.id_SP_EditPaste, self.app.eventWrapper( self.OnSpEditPaste ) )
311
338
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_SP_EditPaste, self.app.eventWrapper( self.OnUpdateUiSpEditPaste ) )
312
339
 
 
340
            wx.EVT_MENU( event_source, wb_ids.id_View_Diff_WbDiff, self.app.eventWrapper( self.OnViewDiffWbDiff ) )
 
341
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_View_Diff_WbDiff, self.app.eventWrapper( self.OnUpdateUiViewDiffWbDiff ) )
 
342
            wx.EVT_MENU( event_source, wb_ids.id_View_Diff_ExtGuiDiff, self.app.eventWrapper( self.OnViewDiffExtGuiDiff ) )
 
343
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_View_Diff_ExtGuiDiff, self.app.eventWrapper( self.OnUpdateUiViewDiffExtGuiDiff ) )
 
344
            wx.EVT_MENU( event_source, wb_ids.id_View_Diff_ExtTextDiff, self.app.eventWrapper( self.OnViewDiffExtTextDiff ) )
 
345
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_View_Diff_ExtTextDiff, self.app.eventWrapper( self.OnUpdateUiViewDiffExtTextDiff ) )
 
346
            wx.EVT_MENU( event_source, wb_ids.id_View_Diff_SvnDiff, self.app.eventWrapper( self.OnViewDiffSvnDiff ) )
 
347
            wx.EVT_UPDATE_UI( event_source, wb_ids.id_View_Diff_SvnDiff, self.app.eventWrapper( self.OnUpdateUiViewDiffSvnDiff ) )
313
348
 
314
349
        wx.EVT_MENU( self, wb_ids.id_File_Edit, try_wrapper( self.OnFileEdit ) )
315
350
        wx.EVT_UPDATE_UI( self, wb_ids.id_File_Edit, try_wrapper( self.OnUpdateUiFileEdit ) )
331
366
        wx.EVT_UPDATE_UI( self, wb_ids.id_SP_Checkout, self.app.eventWrapper( self.OnUpdateUiSpCheckout ) )
332
367
        wx.EVT_MENU( self, wb_ids.id_SP_Cleanup, self.app.eventWrapper( self.OnSpCleanup ) )
333
368
        wx.EVT_UPDATE_UI( self, wb_ids.id_SP_Cleanup, self.app.eventWrapper( self.OnUpdateUiSpCleanup ) )
 
369
        wx.EVT_MENU( self, wb_ids.id_SP_CreateTag, self.app.eventWrapper( self.OnSpCreateTag ) )
 
370
        wx.EVT_UPDATE_UI( self, wb_ids.id_SP_CreateTag, self.app.eventWrapper( self.OnUpdateUiSpCreateTag ) )
 
371
        wx.EVT_MENU( self, wb_ids.id_SP_CreateBranch, self.app.eventWrapper( self.OnSpCreateBranch ) )
 
372
        wx.EVT_UPDATE_UI( self, wb_ids.id_SP_CreateBranch, self.app.eventWrapper( self.OnUpdateUiSpCreateBranch ) )
334
373
        wx.EVT_MENU( self, wb_ids.id_SP_Delete, self.app.eventWrapper( self.OnSpDelete ) )
335
374
        wx.EVT_UPDATE_UI( self, wb_ids.id_SP_Delete, self.app.eventWrapper( self.OnUpdateUiSpDelete ) )
336
375
        wx.EVT_MENU( self, wb_ids.id_SP_DiffMineNew, self.app.eventWrapper( self.OnSpDiffMineNew ) )
396
435
        wx.EVT_SPLITTER_SASH_POS_CHANGED( self.v_split, -1, self.OnVertSashPositionChanged )
397
436
        wx.EVT_SPLITTER_SASH_POS_CHANGED( self.h_split, -1, self.OnHorizSashPositionChanged )
398
437
 
 
438
        wx.stc.EVT_STC_ZOOM(self, -1, self.OnZoom)
 
439
        
399
440
        wx.EVT_CLOSE(self, try_wrapper( self.OnCloseWindow ))
400
441
 
401
442
        # default to the tree panel as the first set_focus can go missing
412
453
        self.list_panel.list_ctrl.SetFocus()
413
454
 
414
455
    def setEventHandler( self, handler ):
415
 
        self.app.log.debug( 'setEventHandler from %r' % self.event_handler )
416
 
        self.app.log.debug( 'setEventHandler   to %r' % handler )
 
456
        if wb_config.debug_selection:
 
457
            print 'ZF: setEventHandler from %r' % self.event_handler
 
458
            print 'ZF: setEventHandler   to %r' % handler
 
459
            import wb_debug
 
460
            wb_debug.printStack( '     ' )
 
461
 
 
462
        self.app.debugShowCallers( 20 )
 
463
 
417
464
        if self.event_handler is not handler:
418
465
            self.event_handler = handler
419
466
            self.clearUpdateUiState()
420
467
 
421
468
    def clearEventHandler( self ):
422
469
        self.app.log.debug( 'clearEventHandler from %r to None' % self.event_handler )
 
470
        if wb_config.debug_selection: print 'ZF: clearEventHandler from %r to None' % self.event_handler
423
471
        self.event_handler = None
424
472
        self.clearUpdateUiState()
425
473
 
 
474
    def isEventHandler( self, handler ):
 
475
        return self.event_handler is handler
 
476
 
426
477
    # Status bar settings
427
478
    def setStatus( self, text ):
428
479
        self.GetStatusBar().SetStatusText( text, WbFrame.status_general )
450
501
 
451
502
    # Handler for the About menu command
452
503
    def OnCmdAbout(self, event):
453
 
        str_message =    ('Work Bench version: %d.%d.%d-%d\n' %
 
504
        str_message =    (T_('Work Bench version: %d.%d.%d-%d\n') %
454
505
                    (wb_version.major, wb_version.minor,
455
506
                     wb_version.patch, wb_version.build) +
456
507
                '\n' + wb_source_control_providers.getProviderAboutStrings() +
457
 
                '\nWxPython %d.%d.%d.%d %s' % wx.VERSION +
 
508
                '\nwxPython %d.%d.%d.%d %s' % wx.VERSION +
458
509
                '\nPython %d.%d.%d %s %d\n' % sys.version_info +
459
 
                '\nCopyright Barry Scott (c) 2003-2006. All rights reserved'
 
510
                T_('\nCopyright Barry Scott (c) 2003-2007. All rights reserved')
460
511
                )
461
512
        wx.LogMessage( str_message )
462
513
 
470
521
        self.refreshFrame()
471
522
 
472
523
    def OnUnlockedUi( self ):
473
 
        self.setAction( 'Ready' )
 
524
        self.setAction( T_('Ready') )
474
525
        self.tree_panel.updateTree()
475
526
 
476
527
    def OnSize( self, event ):
477
528
        if not self.IsMaximized():
478
 
            self.app.prefs.getWindow().frame_size = event.GetSize()
 
529
            self.app.prefs.getWindow().frame_size = self.GetSize()
479
530
        event.Skip()
480
531
 
481
532
    def OnMove( self, event ):
511
562
        self.v_split.SetSashPosition( max( 200, int( w * win_prefs.v_sash_ratio ) ) )
512
563
        event.Skip()
513
564
 
 
565
    def OnZoom(self, evt):
 
566
        win_prefs = self.app.prefs.getWindow()
 
567
        win_prefs.zoom = self.log_panel.GetZoom()
 
568
        
514
569
    #------------------------------------------------------------------------
515
570
    def OnActivateApp( self, is_active ):
516
571
        if is_active and self.app.prefs.getView().auto_refresh:
562
617
        view_prefs = self.app.prefs.getView()
563
618
        event.Check( view_prefs.view_recursive )
564
619
 
 
620
    def OnToggleViewOnlyChanges( self, event ):
 
621
        view_prefs = self.app.prefs.getView()
 
622
        view_prefs.view_onlychanges = not view_prefs.view_onlychanges
 
623
        self.refreshFrame()
 
624
 
 
625
    def OnUpdateViewOnlyChanges( self, event ):
 
626
        view_prefs = self.app.prefs.getView()
 
627
        event.Check( view_prefs.view_onlychanges )
 
628
 
 
629
    def OnViewDiffWbDiff( self, event ):
 
630
        self.app.prefs.getDiffTool().diff_tool_mode = 'built-in'
 
631
        self.app.prefs.writePreferences()
 
632
 
 
633
    def OnUpdateUiViewDiffWbDiff( self, event ):
 
634
        event.Check( self.app.prefs.getDiffTool().diff_tool_mode == 'built-in' )
 
635
 
 
636
    def OnViewDiffExtGuiDiff( self, event ):
 
637
        self.app.prefs.getDiffTool().diff_tool_mode = 'external-gui-diff'
 
638
        self.app.prefs.writePreferences()
 
639
 
 
640
    def OnUpdateUiViewDiffExtGuiDiff( self, event ):
 
641
        event.Enable( self.app.prefs.getDiffTool().gui_diff_tool != '' )
 
642
        event.Check( self.app.prefs.getDiffTool().diff_tool_mode == 'external-gui-diff' )
 
643
 
 
644
    def OnViewDiffExtTextDiff( self, event ):
 
645
        self.app.prefs.getDiffTool().diff_tool_mode = 'external-shell-diff'
 
646
        self.app.prefs.writePreferences()
 
647
 
 
648
    def OnUpdateUiViewDiffExtTextDiff( self, event ):
 
649
        event.Enable( self.app.prefs.getDiffTool().shell_diff_tool != '' )
 
650
        event.Check( self.app.prefs.getDiffTool().diff_tool_mode == 'external-shell-diff' )
 
651
 
 
652
    def OnViewDiffSvnDiff( self, event ):
 
653
        self.app.prefs.getDiffTool().diff_tool_mode = 'svn-diff'
 
654
        self.app.prefs.writePreferences()
 
655
 
 
656
    def OnUpdateUiViewDiffSvnDiff( self, event ):
 
657
        event.Check( self.app.prefs.getDiffTool().diff_tool_mode == 'svn-diff' )
 
658
 
565
659
    def OnRefresh( self, event ):
 
660
        self.app.log.debug( 'OnRefresh()' )
566
661
        self.refreshFrame()
567
662
 
568
663
    def refreshFrame( self ):
 
664
        self.app.log.debug( 'WbFrame.refreshFrame()' )
569
665
        # tell the tree to refresh it will tell the list
570
666
        self.tree_panel.refreshTree()
571
667
 
645
741
        bm_prefs = self.app.prefs.getBookmarks()
646
742
 
647
743
        if not bm_prefs.hasBookmark( pi.url ):
648
 
            print 'Adding bookmark to %s' % pi.wc_path
 
744
            print T_('Adding bookmark to %s') % pi.wc_path
649
745
            bm_prefs.addBookmark( pi )
650
746
 
651
747
            self.__addBookmarkMenuItem( pi )
705
801
        self.getUpdateUiState()
706
802
        event.Enable( self.ui_state_tree.file_exists )
707
803
 
708
 
 
709
804
    def OnSpEditCopy( self, event ):
710
805
        return self.Sp_Dispatch( 'OnSpEditCopy' )
711
806
 
743
838
        if self.ui_state_focus.need_checkout:
744
839
            event.Enable( False )
745
840
        else:
746
 
            event.Enable( self.ui_state_tree.versioned )
 
841
            event.Enable( self.ui_state_focus.versioned and (not self.ui_state_focus.is_folder) )
747
842
 
748
843
    def OnSpCheckin( self, event ):
749
844
        return self.Sp_Dispatch( 'OnSpCheckin' )
777
872
        self.getUpdateUiState()
778
873
        event.Enable( self.ui_state_focus.file_exists and self.ui_state_focus.versioned )
779
874
 
 
875
    def OnSpCreateTag( self, event ):
 
876
        return self.Sp_Dispatch( 'OnSpCreateTag' )
 
877
 
 
878
    def OnUpdateUiSpCreateTag( self, event ):
 
879
        self.getUpdateUiState()
 
880
        event.Enable( self.ui_state_tree.file_exists and self.ui_state_tree.versioned )
 
881
 
 
882
    def OnSpCreateBranch( self, event ):
 
883
        return self.Sp_Dispatch( 'OnSpCreateBranch' )
 
884
 
 
885
    def OnUpdateUiSpCreateBranch( self, event ):
 
886
        self.getUpdateUiState()
 
887
        event.Enable( self.ui_state_tree.file_exists and self.ui_state_tree.versioned )
 
888
 
780
889
    def OnSpDelete( self, event ):
781
890
        return self.Sp_Dispatch( 'OnSpDelete' )
782
891
 
853
962
 
854
963
    def OnUpdateUiSpHistory( self, event ):
855
964
        self.getUpdateUiState()
 
965
        if wb_config.debug_selection_update: print 'ZF: OnUpdateUiSpHistory versioned %r handler %r' % (
 
966
                                                self.ui_state_focus.versioned, self.event_handler)
856
967
        if self.ui_state_focus.need_checkout:
857
968
            event.Enable( False )
858
969
        else:
873
984
 
874
985
    def OnUpdateUiSpLock( self, event ):
875
986
        self.getUpdateUiState()
876
 
        event.Enable( self.ui_state_tree.file_exists )
 
987
        event.Enable( (not self.ui_state_focus.is_folder) and self.ui_state_focus.file_exists )
877
988
 
878
989
    def OnSpMkdir( self, event ):
879
 
        return self.Sp_Dispatch( 'OnSpMkdir' )
 
990
        # always forward to the tree to handle
 
991
        return self.tree_panel.OnSpMkdir()
880
992
 
881
993
    def OnUpdateUiSpMkdir( self, event ):
882
994
        self.getUpdateUiState()
883
995
        event.Enable( self.ui_state_tree.file_exists )
884
996
 
885
997
    def OnSpNewFile( self, event ):
886
 
        return self.Sp_Dispatch( 'OnSpNewFile' )
 
998
        return self.tree_panel.OnSpNewFile()
887
999
 
888
1000
    def OnUpdateUiSpNewFile( self, event ):
889
1001
        self.getUpdateUiState()
959
1071
 
960
1072
    def OnUpdateUiSpUnlock( self, event ):
961
1073
        self.getUpdateUiState()
962
 
        event.Enable( self.ui_state_tree.file_exists )
 
1074
        event.Enable( (not self.ui_state_focus.is_folder) and self.ui_state_focus.file_exists )
963
1075
 
964
1076
    def OnSpUpdate( self, event ):
965
1077
        return self.Sp_Dispatch( 'OnSpUpdate' )
999
1111
            return fn()
1000
1112
 
1001
1113
    def getUpdateUiState( self ):
 
1114
        all_debug_messages = []
1002
1115
        if self.ui_state_tree is None:
1003
 
            if wb_config.debug_selection: print 'Z: getUpdateUiState() tree'
1004
1116
            self.ui_state_tree = self.tree_panel.getUpdateUiState()
1005
1117
            if self.ui_state_tree is None:
1006
 
                self.ui_state_tree = wb_tree_panel.TreeState()
1007
 
            if wb_config.debug_selection: print 'Z: getUpdateUiState() tree need_checkout', self.ui_state_tree.need_checkout
 
1118
                self.ui_state_tree = wb_tree_panel.TreeState( True )
 
1119
            all_debug_messages.append( 'tree place_holder %s' % self.ui_state_tree.place_holder )
1008
1120
 
1009
1121
        if self.ui_state_list is None:
1010
 
            if wb_config.debug_selection: print 'Z: getUpdateUiState() list'
1011
1122
            self.ui_state_list = self.list_panel.getUpdateUiState()
1012
1123
            if self.ui_state_list is None:
1013
 
                self.ui_state_list = wb_list_panel_common.ListItemState()
1014
 
            if wb_config.debug_selection: print 'Z: getUpdateUiState() list need_checkout', self.ui_state_list.need_checkout
 
1124
                self.ui_state_list = wb_list_panel_common.ListItemState( True )
 
1125
            all_debug_messages.append( 'list place_holder %s' % self.ui_state_list.place_holder )
1015
1126
 
1016
1127
        if self.ui_state_focus is None:
1017
1128
            if self.event_handler is None:
1018
 
                if wb_config.debug_selection: print 'Z: getUpdateUiState() event_handler is None set tree'
 
1129
                all_debug_messages.append( 'event_handler is None set tree' )
1019
1130
                self.ui_state_focus = self.ui_state_tree
1020
1131
            elif self.event_handler.isTreeHandler():
1021
 
                if wb_config.debug_selection: print 'Z: getUpdateUiState() event_handler is Tree set tree'
 
1132
                all_debug_messages.append( 'event_handler is Tree set tree' )
1022
1133
                self.ui_state_focus = self.ui_state_tree
1023
1134
            else:
1024
 
                if wb_config.debug_selection: print 'Z: getUpdateUiState() event_handler is List set list'
 
1135
                all_debug_messages.append( 'event_handler is List set list' )
1025
1136
                self.ui_state_focus = self.ui_state_list
1026
 
            if wb_config.debug_selection: print 'Z: getUpdateUiState() focus need_checkout', self.ui_state_focus.need_checkout
 
1137
            all_debug_messages.append( 'focus place_holder %s' % self.ui_state_focus.place_holder )
 
1138
 
 
1139
        if wb_config.debug_selection and len(all_debug_messages)>0:
 
1140
            print 'ZF: getUpdateUiState() ------------------------------'
 
1141
            for message in all_debug_messages:
 
1142
                print '    %s' %message
1027
1143
 
1028
1144
    def clearUpdateUiState( self ):
1029
 
        if wb_config.debug_selection: print 'Z: clearUpdateUiState()'
 
1145
        if wb_config.debug_selection: print 'ZF: clearUpdateUiState()'
1030
1146
        self.ui_state_tree = None
1031
1147
        self.ui_state_list = None
1032
1148
        self.ui_state_focus = None
1033
1149
 
1034
 
 
1035
1150
#--------------------------------------------------------------------------------
1036
1151
class LogCtrlPanel(wx.Panel):
1037
 
    ''' LogCtrlPanel '''
1038
1152
    def __init__( self, app, parent ):
1039
1153
        wx.Panel.__init__(self, parent, -1)
1040
1154
 
1043
1157
 
1044
1158
        # Redirect the console IO to this panel
1045
1159
        sys.stdin = file( wb_platform_specific.getNullDevice(), 'r' )
1046
 
        sys.stdout = self
1047
 
        sys.stderr = self
 
1160
        if self.app.isStdIoRedirect():
 
1161
            sys.stdout = self
 
1162
            sys.stderr = self
1048
1163
 
1049
1164
        # Redirect log to the Log panel
1050
1165
        log_handler = LogHandler( self.text_ctrl )
1052
1167
 
1053
1168
        wx.EVT_SIZE( self, wb_exceptions.TryWrapper( self.app.log, self.OnSize ) )
1054
1169
 
 
1170
 
1055
1171
    #---------- Event handlers ------------------------------------------------------------
1056
1172
 
1057
1173
    def OnSize( self, event ):
1085
1201
    def ClearLog( self ):
1086
1202
        self.text_ctrl.ClearText()
1087
1203
 
 
1204
    def GetZoom(self):
 
1205
        return self.text_ctrl.GetZoom()
 
1206
 
 
1207
    def SetZoom(self, zoom):
 
1208
        self.text_ctrl.SetZoom(zoom)
 
1209
 
1088
1210
#--------------------------------------------------------------------------------
1089
1211
class LogHandler(logging.Handler):
1090
1212
    def __init__( self, log_ctrl ):
1116
1238
    def __init__(self, app, parent):
1117
1239
        self.app = app
1118
1240
 
1119
 
        wx.stc.StyledTextCtrl.__init__(self, parent, -1,
1120
 
                wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
1121
 
 
 
1241
        wx.stc.StyledTextCtrl.__init__(self, parent)
1122
1242
        self.SetReadOnly( True )
1123
1243
 
1124
1244
        self.style_normal = 0
1133
1253
        self.SetMarginWidth(2, 0)
1134
1254
 
1135
1255
        self.StyleSetSpec( wx.stc.STC_STYLE_DEFAULT, 
1136
 
                "size:%d,face:%s,fore:#000000" % (point_size, face) )
 
1256
                "size:%d,face:%s,fore:#000000" % (wb_config.point_size, wb_config.face) )
1137
1257
 
1138
1258
        self.StyleSetSpec( self.style_normal,   "fore:#000000" )
1139
1259
        self.StyleSetSpec( self.style_error,    "fore:#DC143C" )    # Crimson
1142
1262
        self.StyleSetSpec( self.style_critical, "fore:#BA55D3" )    # Medium Orchid
1143
1263
        self.StyleSetSpec( self.style_debug,    "fore:#DC143C" )    # Crimson
1144
1264
 
 
1265
        wx.EVT_KEY_DOWN( self, self.OnKeyDown )
 
1266
 
 
1267
    def OnKeyDown( self, event ):
 
1268
        """
 
1269
        Don't let the STC treat the TAB normally (insert a tab
 
1270
        character.)  Turn it into a navigation event instead.
 
1271
        """
 
1272
        if event.GetKeyCode() == wx.WXK_TAB:
 
1273
            flags = wx.NavigationKeyEvent.IsForward
 
1274
            if event.ShiftDown():
 
1275
                flags = wx.NavigationKeyEvent.IsBackward
 
1276
            if event.ControlDown():
 
1277
                flags |= wx.NavigationKeyEvent.WinChange
 
1278
            self.Navigate(flags)            
 
1279
        else:
 
1280
            event.Skip()
 
1281
 
1145
1282
    def SetWindowSize( self, size ):
1146
1283
        wx.stc.StyledTextCtrl.SetSize( self, size )
1147
1284
        self.EnsureCaretVisible()