bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
1 |
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
|
0.8.29
by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups. |
2 |
#
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
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.
|
|
0.8.29
by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups. |
7 |
#
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
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.
|
|
0.8.29
by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups. |
12 |
#
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
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: |
|
0.8.14
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
20 |
import pygtk |
21 |
pygtk.require("2.0") |
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
22 |
except: |
0.8.14
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
23 |
pass
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
24 |
try: |
0.8.14
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
25 |
import gtk |
26 |
import gtk.glade |
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
27 |
except: |
0.8.14
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
28 |
sys.exit(1) |
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
29 |
|
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
30 |
import olive.backend.errors as errors |
31 |
||
0.8.13
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
32 |
from dialog import OliveDialog |
0.8.24
by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list. |
33 |
from menu import OliveMenu |
0.8.13
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
34 |
|
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
35 |
class OliveHandler: |
36 |
""" Signal handler class for Olive. """ |
|
0.8.15
by Szilveszter Farkas (Phanatic)
2006-07-18 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
37 |
def __init__(self, gladefile, comm): |
0.8.12
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
38 |
self.gladefile = gladefile |
0.8.15
by Szilveszter Farkas (Phanatic)
2006-07-18 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
39 |
self.comm = comm |
40 |
||
0.8.13
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
41 |
self.dialog = OliveDialog(self.gladefile) |
0.8.24
by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list. |
42 |
|
43 |
self.menu = OliveMenu(self.gladefile, self.comm, self.dialog) |
|
0.8.13
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
44 |
|
45 |
def on_about_activate(self, widget): |
|
46 |
self.dialog.about() |
|
0.8.14
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
47 |
|
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
48 |
def on_menuitem_add_files_activate(self, widget): |
49 |
""" Add file(s)... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
50 |
from add import OliveAdd |
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
51 |
add = OliveAdd(self.gladefile, self.comm) |
52 |
add.display() |
|
53 |
||
0.8.22
by Szilveszter Farkas (Phanatic)
2006-07-31 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
54 |
def on_menuitem_branch_get_activate(self, widget): |
55 |
""" Branch/Get... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
56 |
from branch import OliveBranch |
0.8.15
by Szilveszter Farkas (Phanatic)
2006-07-18 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
57 |
branch = OliveBranch(self.gladefile, self.comm) |
0.8.14
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
58 |
branch.display() |
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
59 |
|
0.8.22
by Szilveszter Farkas (Phanatic)
2006-07-31 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
60 |
def on_menuitem_branch_checkout_activate(self, widget): |
61 |
""" Branch/Checkout... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
62 |
from checkout import OliveCheckout |
0.8.22
by Szilveszter Farkas (Phanatic)
2006-07-31 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
63 |
checkout = OliveCheckout(self.gladefile, self.comm) |
64 |
checkout.display() |
|
65 |
||
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
66 |
def on_menuitem_branch_commit_activate(self, widget): |
67 |
""" Branch/Commit... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
68 |
from commit import OliveCommit |
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
69 |
commit = OliveCommit(self.gladefile, self.comm) |
70 |
commit.display() |
|
71 |
||
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
72 |
def on_menuitem_branch_pull_activate(self, widget): |
73 |
""" Branch/Pull menu handler. """ |
|
74 |
import olive.backend.update as update |
|
75 |
||
76 |
self.comm.set_busy(self.comm.window_main) |
|
77 |
||
78 |
try: |
|
79 |
ret = update.pull(self.comm.get_path()) |
|
80 |
except errors.NotBranchError: |
|
81 |
self.dialog.error_dialog('Directory is not a branch.') |
|
82 |
except errors.NoLocationKnown: |
|
83 |
self.dialog.error_dialog('Parent location is unknown.') |
|
84 |
else: |
|
85 |
self.dialog.info_dialog('%d revision(s) pulled.' % ret) |
|
86 |
||
87 |
self.comm.set_busy(self.comm.window_main, False) |
|
88 |
||
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
89 |
def on_menuitem_branch_push_activate(self, widget): |
90 |
""" Branch/Push... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
91 |
from push import OlivePush |
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
92 |
push = OlivePush(self.gladefile, self.comm) |
93 |
push.display() |
|
94 |
||
0.8.29
by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups. |
95 |
def on_menuitem_branch_status_activate(self, widget): |
96 |
""" Branch/Status... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
97 |
from status import OliveStatus |
0.8.29
by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups. |
98 |
status = OliveStatus(self.gladefile, self.comm) |
99 |
status.display() |
|
100 |
||
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
101 |
def on_menuitem_branch_initialize_activate(self, widget): |
102 |
""" Initialize current directory. """ |
|
103 |
import olive.backend.init as init |
|
104 |
||
105 |
try: |
|
106 |
init.init(self.comm.get_path()) |
|
107 |
except errors.AlreadyBranchError, errmsg: |
|
108 |
self.dialog.error_dialog('Directory is already a branch: %s' % errmsg) |
|
109 |
except errors.BranchExistsWithoutWorkingTree, errmsg: |
|
110 |
self.dialog.error_dialog('Branch exists without a working tree: %s' % errmsg) |
|
111 |
else: |
|
112 |
self.dialog.info_dialog('Directory successfully initialized.') |
|
113 |
self.comm.refresh_right() |
|
114 |
||
115 |
def on_menuitem_remove_file_activate(self, widget): |
|
116 |
""" Remove (unversion) selected file. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
117 |
from remove import OliveRemove |
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
118 |
remove = OliveRemove(self.gladefile, self.comm) |
119 |
remove.display() |
|
120 |
||
0.8.28
by Szilveszter Farkas (Phanatic)
Statistics menu added |
121 |
def on_menuitem_stats_diff_activate(self, widget): |
122 |
""" Statistics/Differences... menu handler. """ |
|
0.8.36
by Szilveszter Farkas (Phanatic)
Implemented pull functionality. |
123 |
from diff import OliveDiff |
0.8.28
by Szilveszter Farkas (Phanatic)
Statistics menu added |
124 |
diff = OliveDiff(self.gladefile, self.comm) |
125 |
diff.display() |
|
126 |
||
0.8.33
by Szilveszter Farkas (Phanatic)
Implemented bookmarking. |
127 |
def on_treeview_left_button_press_event(self, widget, event): |
128 |
""" Occurs when somebody right-clicks in the bookmark list. """ |
|
129 |
if event.button == 3: |
|
130 |
self.menu.left_context_menu().popup(None, None, None, 0, |
|
131 |
event.time) |
|
132 |
||
133 |
def on_treeview_left_row_activated(self, treeview, path, view_column): |
|
134 |
""" Occurs when somebody double-clicks or enters an item in the |
|
135 |
bookmark list. """
|
|
136 |
self.comm.set_busy(treeview) |
|
137 |
||
138 |
newdir = self.comm.get_selected_left() |
|
139 |
self.comm.set_path(newdir) |
|
140 |
||
141 |
self.comm.refresh_right() |
|
142 |
||
143 |
self.comm.set_busy(treeview, False) |
|
144 |
||
0.8.24
by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list. |
145 |
def on_treeview_right_button_press_event(self, widget, event): |
146 |
""" Occurs when somebody right-clicks in the file list. """ |
|
147 |
if event.button == 3: |
|
148 |
self.menu.right_context_menu().popup(None, None, None, 0, |
|
149 |
event.time) |
|
150 |
||
0.8.18
by Szilveszter Farkas (Phanatic)
2006-07-20 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
151 |
def on_treeview_right_row_activated(self, treeview, path, view_column): |
152 |
""" Occurs when somebody double-clicks or enters an item in the |
|
153 |
file list. """
|
|
154 |
import os.path |
|
155 |
||
0.8.19
by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
156 |
newdir = self.comm.get_selected_right() |
0.8.18
by Szilveszter Farkas (Phanatic)
2006-07-20 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
157 |
|
158 |
if newdir == '..': |
|
159 |
self.comm.set_path(os.path.split(self.comm.get_path())[0]) |
|
160 |
else: |
|
161 |
self.comm.set_path(self.comm.get_path() + '/' + newdir) |
|
162 |
||
163 |
self.comm.refresh_right() |
|
0.8.13
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
164 |
|
0.8.32
by Szilveszter Farkas (Phanatic)
Implemented OlivePreferences; some wording fixes. |
165 |
def on_window_main_delete_event(self, widget, event=None): |
166 |
""" Do some stuff before exiting. """ |
|
167 |
self.comm.pref.write() |
|
168 |
self.comm.window_main.destroy() |
|
169 |
||
0.8.13
by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com> |
170 |
def not_implemented(self, widget): |
171 |
""" Display a Not implemented error message. """ |
|
172 |
self.dialog.error_dialog('This feature is not yet implemented.') |
|
173 |