/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/frontend/gtk/handler.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-13 14:08:06 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060813140806-3364d3e02a086d51
Modified OliveDialog class interface; huge cleanups.

2006-08-13  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/frontend/gtk/branch.py: display number of revisions branched
    * olive/frontend/gtk/*: use new dialog interface with detailed descriptions
    * olive/frontend/gtk/dialog.py: modified according to GNOME HIG (primary
      and secondary text)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
except:
28
28
    sys.exit(1)
29
29
 
30
 
from olive.backend.info import is_branch
31
30
import olive.backend.errors as errors
32
31
 
33
32
from dialog import OliveDialog
79
78
        try:
80
79
            ret = update.pull(self.comm.get_path())
81
80
        except errors.NotBranchError:
82
 
            self.dialog.error_dialog(_('Directory is not a branch'),
83
 
                                     _('You can perform this action only in a branch.'))
 
81
            self.dialog.error_dialog('Directory is not a branch',
 
82
                                     'You can perform this action only in a branch.')
84
83
        except errors.NoLocationKnown:
85
 
            self.dialog.error_dialog(_('Parent location is unknown'),
86
 
                                     _('Pulling is not possible until there is no parent location.'))
 
84
            self.dialog.error_dialog('Parent location is unknown',
 
85
                                     'Pulling is not possible until there is no parent location.')
87
86
        else:
88
 
            self.dialog.info_dialog(_('Pull successful'),
89
 
                                    _('%d revision(s) pulled.') % ret)
 
87
            self.dialog.info_dialog('Pull successful',
 
88
                                    '%d revision(s) pulled.' % ret)
90
89
        
91
90
        self.comm.set_busy(self.comm.window_main, False)
92
91
    
109
108
        try:
110
109
            init.init(self.comm.get_path())
111
110
        except errors.AlreadyBranchError, errmsg:
112
 
            self.dialog.error_dialog(_('Directory is already a branch'),
113
 
                                     _('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
 
111
            self.dialog.error_dialog('Directory is already a branch',
 
112
                                     'The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.' % errmsg)
114
113
        except errors.BranchExistsWithoutWorkingTree, errmsg:
115
 
            self.dialog.error_dialog(_('Branch without a working tree'),
116
 
                                     _('The current directory (%s)\nis a branch without a working tree.') % errmsg)
 
114
            self.dialog.error_dialog('Branch without a working tree',
 
115
                                     'The current directory (%s)\nis a branch without a working tree.' % errmsg)
117
116
        except:
118
117
            raise
119
118
        else:
120
 
            self.dialog.info_dialog(_('Ininialize successful'),
121
 
                                    _('Directory successfully initialized.'))
 
119
            self.dialog.info_dialog('Ininialize successful',
 
120
                                    'Directory successfully initialized.')
122
121
            self.comm.refresh_right()
123
122
        
124
123
    def on_menuitem_file_make_directory_activate(self, widget):
163
162
        log = OliveLog(self.gladefile, self.comm, self.dialog)
164
163
        log.display()
165
164
    
166
 
    def on_menuitem_view_refresh_activate(self, widget):
167
 
        """ View/Refresh menu handler. """
168
 
        # Refresh the left pane
169
 
        self.comm.refresh_left()
170
 
        # Refresh the right pane
171
 
        self.comm.refresh_right()
172
 
    
173
 
    def on_menuitem_view_show_hidden_files_activate(self, widget):
174
 
        """ View/Show hidden files menu handler. """
175
 
        if widget.get_active():
176
 
            # Show hidden files
177
 
            self.comm.pref.set_preference('dotted_files', True)
178
 
            self.comm.pref.refresh()
179
 
            self.comm.refresh_right()
180
 
        else:
181
 
            # Do not show hidden files
182
 
            self.comm.pref.set_preference('dotted_files', False)
183
 
            self.comm.pref.refresh()
184
 
            self.comm.refresh_right()
185
 
 
186
165
    def on_treeview_left_button_press_event(self, widget, event):
187
166
        """ Occurs when somebody right-clicks in the bookmark list. """
188
167
        if event.button == 3:
204
183
    def on_treeview_right_button_press_event(self, widget, event):
205
184
        """ Occurs when somebody right-clicks in the file list. """
206
185
        if event.button == 3:
207
 
            # get the menu items
208
 
            m_add = self.menu.ui.get_widget('/context_right/add')
209
 
            m_remove = self.menu.ui.get_widget('/context_right/remove')
210
 
            m_commit = self.menu.ui.get_widget('/context_right/commit')
211
 
            m_diff = self.menu.ui.get_widget('/context_right/diff')
212
 
            # check if we're in a branch
213
 
            if not is_branch(self.comm.get_path()):
214
 
                m_add.set_sensitive(False)
215
 
                m_remove.set_sensitive(False)
216
 
                m_commit.set_sensitive(False)
217
 
                m_diff.set_sensitive(False)
218
 
            else:
219
 
                m_add.set_sensitive(True)
220
 
                m_remove.set_sensitive(True)
221
 
                m_commit.set_sensitive(True)
222
 
                m_diff.set_sensitive(True)
223
186
            self.menu.right_context_menu().popup(None, None, None, 0,
224
187
                                                 event.time)
225
188
        
233
196
        if newdir == '..':
234
197
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
235
198
        else:
236
 
            fullpath = self.comm.get_path() + '/' + newdir
237
 
            if os.path.isdir(fullpath):
238
 
                # selected item is an existant directory
239
 
                self.comm.set_path(fullpath)
240
 
            else:
241
 
                if sys.platform == 'win32':
242
 
                    # open the file with the default application
243
 
                    os.startfile(fullpath)
244
 
                else:
245
 
                    # TODO: support other OSes
246
 
                    print "DEBUG: double-click on non-Win32 platforms not supported."
 
199
            self.comm.set_path(self.comm.get_path() + '/' + newdir)
247
200
        
248
201
        self.comm.refresh_right()
249
202
    
263
216
 
264
217
    def not_implemented(self, widget):
265
218
        """ Display a Not implemented error message. """
266
 
        self.dialog.error_dialog(_('We feel sorry'),
267
 
                                 _('This feature is not yet implemented.'))
 
219
        self.dialog.error_dialog('I feel sorry',
 
220
                                 'This feature is not yet implemented.')
268
221