/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-01 16:16:31 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-20060801161631-ca1ac79e3726e307
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update

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

    * olive/frontend/gtk/push.py: now the number of pushed revisions gets
      displayed (Fixed: #54698)
    * olive/backend/info.py: added is_checkout()
    * olive/frontend/gtk/commit.py: local commit checkbox shows up only if the
      current directory is a checkout
    * olive/backend/fileops.py: upgraded to new API (compare_trees deprecated)
    * many files: the cursor changes to a watch when performing time consuming
      operations (Fixed: #54015)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
 
2
 
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
 
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
 
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
import sys
 
18
 
 
19
try:
 
20
    import pygtk
 
21
    pygtk.require("2.0")
 
22
except:
 
23
    pass
 
24
try:
 
25
    import gtk
 
26
    import gtk.glade
 
27
except:
 
28
    sys.exit(1)
 
29
 
 
30
import olive.backend.errors as errors
 
31
 
 
32
from add import OliveAdd
 
33
from branch import OliveBranch
 
34
from checkout import OliveCheckout
 
35
from commit import OliveCommit
 
36
from dialog import OliveDialog
 
37
from push import OlivePush
 
38
from remove import OliveRemove
 
39
 
 
40
class OliveHandler:
 
41
    """ Signal handler class for Olive. """
 
42
    def __init__(self, gladefile, comm):
 
43
        self.gladefile = gladefile
 
44
        self.comm = comm
 
45
        
 
46
        self.dialog = OliveDialog(self.gladefile)
 
47
    
 
48
    def on_about_activate(self, widget):
 
49
        self.dialog.about()
 
50
        
 
51
    def on_menuitem_add_files_activate(self, widget):
 
52
        """ Add file(s)... menu handler. """
 
53
        add = OliveAdd(self.gladefile, self.comm)
 
54
        add.display()
 
55
    
 
56
    def on_menuitem_branch_get_activate(self, widget):
 
57
        """ Branch/Get... menu handler. """
 
58
        branch = OliveBranch(self.gladefile, self.comm)
 
59
        branch.display()
 
60
    
 
61
    def on_menuitem_branch_checkout_activate(self, widget):
 
62
        """ Branch/Checkout... menu handler. """
 
63
        checkout = OliveCheckout(self.gladefile, self.comm)
 
64
        checkout.display()
 
65
    
 
66
    def on_menuitem_branch_commit_activate(self, widget):
 
67
        """ Branch/Commit... menu handler. """
 
68
        commit = OliveCommit(self.gladefile, self.comm)
 
69
        commit.display()
 
70
    
 
71
    def on_menuitem_branch_push_activate(self, widget):
 
72
        """ Branch/Push... menu handler. """
 
73
        push = OlivePush(self.gladefile, self.comm)
 
74
        push.display()
 
75
    
 
76
    def on_menuitem_branch_initialize_activate(self, widget):
 
77
        """ Initialize current directory. """
 
78
        import olive.backend.init as init
 
79
        
 
80
        try:
 
81
            init.init(self.comm.get_path())
 
82
        except errors.AlreadyBranchError, errmsg:
 
83
            self.dialog.error_dialog('Directory is already a branch: %s' % errmsg)
 
84
        except errors.BranchExistsWithoutWorkingTree, errmsg:
 
85
            self.dialog.error_dialog('Branch exists without a working tree: %s' % errmsg)
 
86
        else:
 
87
            self.dialog.info_dialog('Directory successfully initialized.')
 
88
            self.comm.refresh_right()
 
89
        
 
90
    def on_menuitem_remove_file_activate(self, widget):
 
91
        """ Remove (unversion) selected file. """
 
92
        remove = OliveRemove(self.gladefile, self.comm)
 
93
        remove.display()
 
94
    
 
95
    def on_treeview_right_row_activated(self, treeview, path, view_column):
 
96
        """ Occurs when somebody double-clicks or enters an item in the
 
97
        file list. """
 
98
        import os.path
 
99
        
 
100
        newdir = self.comm.get_selected_right()
 
101
        
 
102
        if newdir == '..':
 
103
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
 
104
        else:
 
105
            self.comm.set_path(self.comm.get_path() + '/' + newdir)
 
106
        
 
107
        self.comm.refresh_right()
 
108
    
 
109
    def not_implemented(self, widget):
 
110
        """ Display a Not implemented error message. """
 
111
        self.dialog.error_dialog('This feature is not yet implemented.')
 
112