/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-03 10:44:56 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-20060803104456-b5f901b6775ef158
Push dialog now displays stored location

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

    * olive/frontend/gtk/push.py: display known push location if available
    * olive/backend/info.py: implemented get_push_location()

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 menu import OliveMenu
 
38
from push import OlivePush
 
39
from remove import OliveRemove
 
40
 
 
41
class OliveHandler:
 
42
    """ Signal handler class for Olive. """
 
43
    def __init__(self, gladefile, comm):
 
44
        self.gladefile = gladefile
 
45
        self.comm = comm
 
46
        
 
47
        self.dialog = OliveDialog(self.gladefile)
 
48
        
 
49
        self.menu = OliveMenu(self.gladefile, self.comm, self.dialog)
 
50
    
 
51
    def on_about_activate(self, widget):
 
52
        self.dialog.about()
 
53
        
 
54
    def on_menuitem_add_files_activate(self, widget):
 
55
        """ Add file(s)... menu handler. """
 
56
        add = OliveAdd(self.gladefile, self.comm)
 
57
        add.display()
 
58
    
 
59
    def on_menuitem_branch_get_activate(self, widget):
 
60
        """ Branch/Get... menu handler. """
 
61
        branch = OliveBranch(self.gladefile, self.comm)
 
62
        branch.display()
 
63
    
 
64
    def on_menuitem_branch_checkout_activate(self, widget):
 
65
        """ Branch/Checkout... menu handler. """
 
66
        checkout = OliveCheckout(self.gladefile, self.comm)
 
67
        checkout.display()
 
68
    
 
69
    def on_menuitem_branch_commit_activate(self, widget):
 
70
        """ Branch/Commit... menu handler. """
 
71
        commit = OliveCommit(self.gladefile, self.comm)
 
72
        commit.display()
 
73
    
 
74
    def on_menuitem_branch_push_activate(self, widget):
 
75
        """ Branch/Push... menu handler. """
 
76
        push = OlivePush(self.gladefile, self.comm)
 
77
        push.display()
 
78
    
 
79
    def on_menuitem_branch_initialize_activate(self, widget):
 
80
        """ Initialize current directory. """
 
81
        import olive.backend.init as init
 
82
        
 
83
        try:
 
84
            init.init(self.comm.get_path())
 
85
        except errors.AlreadyBranchError, errmsg:
 
86
            self.dialog.error_dialog('Directory is already a branch: %s' % errmsg)
 
87
        except errors.BranchExistsWithoutWorkingTree, errmsg:
 
88
            self.dialog.error_dialog('Branch exists without a working tree: %s' % errmsg)
 
89
        else:
 
90
            self.dialog.info_dialog('Directory successfully initialized.')
 
91
            self.comm.refresh_right()
 
92
        
 
93
    def on_menuitem_remove_file_activate(self, widget):
 
94
        """ Remove (unversion) selected file. """
 
95
        remove = OliveRemove(self.gladefile, self.comm)
 
96
        remove.display()
 
97
    
 
98
    def on_treeview_right_button_press_event(self, widget, event):
 
99
        """ Occurs when somebody right-clicks in the file list. """
 
100
        if event.button == 3:
 
101
            self.menu.right_context_menu().popup(None, None, None, 0,
 
102
                                                 event.time)
 
103
        
 
104
    def on_treeview_right_row_activated(self, treeview, path, view_column):
 
105
        """ Occurs when somebody double-clicks or enters an item in the
 
106
        file list. """
 
107
        import os.path
 
108
        
 
109
        newdir = self.comm.get_selected_right()
 
110
        
 
111
        if newdir == '..':
 
112
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
 
113
        else:
 
114
            self.comm.set_path(self.comm.get_path() + '/' + newdir)
 
115
        
 
116
        self.comm.refresh_right()
 
117
    
 
118
    def not_implemented(self, widget):
 
119
        """ Display a Not implemented error message. """
 
120
        self.dialog.error_dialog('This feature is not yet implemented.')
 
121