/b-gtk/fix-viz

To get this branch, use:
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.11.1 by Jelmer Vernooij
Eliminate olive.backend.errors.
30
import bzrlib.errors as errors
0.11.5 by Jelmer Vernooij
Eliminate olive.backend.update
31
from bzrlib.branch import Branch
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
32
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
33
from dialog import OliveDialog
0.8.24 by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list.
34
from menu import OliveMenu
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
35
0.8.12 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
36
class OliveHandler:
37
    """ Signal handler class for Olive. """
0.8.15 by Szilveszter Farkas (Phanatic)
2006-07-18 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
38
    def __init__(self, gladefile, comm):
0.8.12 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
39
        self.gladefile = gladefile
0.8.15 by Szilveszter Farkas (Phanatic)
2006-07-18 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
40
        self.comm = comm
41
        
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
42
        self.dialog = OliveDialog(self.gladefile)
0.8.24 by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list.
43
        
44
        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>
45
    
46
    def on_about_activate(self, widget):
47
        self.dialog.about()
0.8.14 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
48
        
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
49
    def on_menuitem_add_files_activate(self, widget):
50
        """ Add file(s)... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
51
        from add import OliveAdd
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
52
        add = OliveAdd(self.gladefile, self.comm, self.dialog)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
53
        add.display()
54
    
0.8.22 by Szilveszter Farkas (Phanatic)
2006-07-31 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
55
    def on_menuitem_branch_get_activate(self, widget):
56
        """ Branch/Get... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
57
        from branch import OliveBranch
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
58
        branch = OliveBranch(self.gladefile, self.comm, self.dialog)
0.8.14 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
59
        branch.display()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
60
    
0.8.22 by Szilveszter Farkas (Phanatic)
2006-07-31 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
61
    def on_menuitem_branch_checkout_activate(self, widget):
62
        """ Branch/Checkout... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
63
        from checkout import OliveCheckout
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
64
        checkout = OliveCheckout(self.gladefile, self.comm, self.dialog)
0.8.22 by Szilveszter Farkas (Phanatic)
2006-07-31 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
65
        checkout.display()
66
    
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
67
    def on_menuitem_branch_commit_activate(self, widget):
68
        """ Branch/Commit... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
69
        from commit import OliveCommit
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
70
        commit = OliveCommit(self.gladefile, self.comm, self.dialog)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
71
        commit.display()
72
    
0.8.66 by Szilveszter Farkas (Phanatic)
Implemented Missing revisions functionality.
73
    def on_menuitem_branch_missing_revisions_activate(self, widget):
74
        """ Branch/Missing revisions menu handler. """
75
        
76
        self.comm.set_busy(self.comm.window_main)
77
        
78
        try:
0.11.5 by Jelmer Vernooij
Eliminate olive.backend.update
79
            import bzrlib
80
            
81
            try:
82
                local_branch = Branch.open_containing(self.comm.get_path())[0]
83
            except NotBranchError:
84
                self.dialog.error_dialog(_('Directory is not a branch'),
85
                                         _('You can perform this action only in a branch.'))
86
                return
87
            
88
            other_branch = local_branch.get_parent()
89
            if other_branch is None:
90
                self.dialog.error_dialog(_('Parent location is unknown'),
91
                                         _('Cannot determine missing revisions if no parent location is known.'))
92
                return
93
            
94
            remote_branch = Branch.open(other_branch)
95
            
96
            if remote_branch.base == local_branch.base:
97
                remote_branch = local_branch
98
99
            ret = len(local_branch.missing_revisions(remote_branch))
100
0.8.66 by Szilveszter Farkas (Phanatic)
Implemented Missing revisions functionality.
101
            if ret > 0:
102
                self.dialog.info_dialog(_('There are missing revisions'),
103
                                        _('%d revision(s) missing.') % ret)
104
            else:
105
                self.dialog.info_dialog(_('Local branch up to date'),
106
                                        _('There are no missing revisions.'))
0.11.5 by Jelmer Vernooij
Eliminate olive.backend.update
107
        finally:
108
            self.comm.set_busy(self.comm.window_main, False)
0.8.66 by Szilveszter Farkas (Phanatic)
Implemented Missing revisions functionality.
109
    
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
110
    def on_menuitem_branch_pull_activate(self, widget):
111
        """ Branch/Pull menu handler. """
112
        
113
        self.comm.set_busy(self.comm.window_main)
0.11.5 by Jelmer Vernooij
Eliminate olive.backend.update
114
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
115
        try:
0.11.5 by Jelmer Vernooij
Eliminate olive.backend.update
116
            try:
117
                tree_to = WorkingTree.open_containing(self.comm.get_path())[0]
118
                branch_to = tree_to.branch
119
            except NoWorkingTree:
120
                tree_to = None
121
                branch_to = Branch.open_containing(self.comm.get_path())[0]
122
            except NoBranchError:
123
                 self.dialog.error_dialog(_('Directory is not a branch'),
124
                                         _('You can perform this action only in a branch.'))
125
126
            location = branch_to.get_parent()
127
            if location is None:
128
                self.dialog.error_dialog(_('Parent location is unknown'),
129
                                         _('Pulling is not possible until there is a parent location.'))
130
                return
131
132
            try:
133
                branch_from = Branch.open(location)
134
            except errors.NotBranchError:
135
                self.dialog.error_dialog(_('Directory is not a branch'),
136
                                         _('You can perform this action only in a branch.'))
137
138
            if branch_to.get_parent() is None:
139
                branch_to.set_parent(branch_from.base)
140
141
            old_rh = branch_to.revision_history()
142
            if tree_to is not None:
143
                tree_to.pull(branch_from, overwrite)
144
            else:
145
                branch_to.pull(branch_from, overwrite)
146
            
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
147
            self.dialog.info_dialog(_('Pull successful'),
148
                                    _('%d revision(s) pulled.') % ret)
0.11.5 by Jelmer Vernooij
Eliminate olive.backend.update
149
            
150
        finally:
151
            self.comm.set_busy(self.comm.window_main, False)
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
152
    
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
153
    def on_menuitem_branch_push_activate(self, widget):
154
        """ Branch/Push... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
155
        from push import OlivePush
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
156
        push = OlivePush(self.gladefile, self.comm, self.dialog)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
157
        push.display()
158
    
0.8.29 by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups.
159
    def on_menuitem_branch_status_activate(self, widget):
160
        """ Branch/Status... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
161
        from status import OliveStatus
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
162
        status = OliveStatus(self.gladefile, self.comm, self.dialog)
0.8.29 by Szilveszter Farkas (Phanatic)
Implemented Status window; some code cleanups.
163
        status.display()
164
    
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
165
    def on_menuitem_branch_initialize_activate(self, widget):
166
        """ Initialize current directory. """
167
        try:
0.11.7 by Jelmer Vernooij
Integrate olive.backend.init
168
            location = self.comm.get_path()
169
            from bzrlib.builtins import get_format_type
170
171
            format = get_format_type('default')
172
 
173
            if not os.path.exists(location):
174
                os.mkdir(location)
175
     
176
            try:
177
                existing_bzrdir = bzrdir.BzrDir.open(location)
178
            except NotBranchError:
179
                bzrdir.BzrDir.create_branch_convenience(location, format=format)
180
            else:
181
                if existing_bzrdir.has_branch():
182
                    if existing_bzrdir.has_workingtree():
183
                        raise AlreadyBranchError(location)
184
                    else:
185
                        raise BranchExistsWithoutWorkingTree(location)
186
                else:
187
                    existing_bzrdir.create_branch()
188
                    existing_bzrdir.create_workingtree()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
189
        except errors.AlreadyBranchError, errmsg:
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
190
            self.dialog.error_dialog(_('Directory is already a branch'),
191
                                     _('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
192
        except errors.BranchExistsWithoutWorkingTree, errmsg:
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
193
            self.dialog.error_dialog(_('Branch without a working tree'),
194
                                     _('The current directory (%s)\nis a branch without a working tree.') % errmsg)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
195
        else:
0.11.7 by Jelmer Vernooij
Integrate olive.backend.init
196
            self.dialog.info_dialog(_('Initialize successful'),
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
197
                                    _('Directory successfully initialized.'))
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
198
            self.comm.refresh_right()
199
        
0.8.37 by Szilveszter Farkas (Phanatic)
Implemented Make directory functionality; some cleanups.
200
    def on_menuitem_file_make_directory_activate(self, widget):
201
        """ File/Make directory... menu handler. """
202
        from mkdir import OliveMkdir
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
203
        mkdir = OliveMkdir(self.gladefile, self.comm, self.dialog)
0.8.37 by Szilveszter Farkas (Phanatic)
Implemented Make directory functionality; some cleanups.
204
        mkdir.display()
205
    
0.8.38 by Szilveszter Farkas (Phanatic)
Implemented Move functionality; move() backend code refined.
206
    def on_menuitem_file_move_activate(self, widget):
207
        """ File/Move... menu handler. """
208
        from move import OliveMove
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
209
        move = OliveMove(self.gladefile, self.comm, self.dialog)
0.8.38 by Szilveszter Farkas (Phanatic)
Implemented Move functionality; move() backend code refined.
210
        move.display()
211
    
0.8.40 by Szilveszter Farkas (Phanatic)
Implemented Rename functionality.
212
    def on_menuitem_file_rename_activate(self, widget):
213
        """ File/Rename... menu handler. """
214
        from rename import OliveRename
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
215
        rename = OliveRename(self.gladefile, self.comm, self.dialog)
0.8.40 by Szilveszter Farkas (Phanatic)
Implemented Rename functionality.
216
        rename.display()
217
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
218
    def on_menuitem_remove_file_activate(self, widget):
219
        """ Remove (unversion) selected file. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
220
        from remove import OliveRemove
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
221
        remove = OliveRemove(self.gladefile, self.comm, self.dialog)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
222
        remove.display()
223
    
0.8.28 by Szilveszter Farkas (Phanatic)
Statistics menu added
224
    def on_menuitem_stats_diff_activate(self, widget):
225
        """ Statistics/Differences... menu handler. """
0.8.36 by Szilveszter Farkas (Phanatic)
Implemented pull functionality.
226
        from diff import OliveDiff
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
227
        diff = OliveDiff(self.gladefile, self.comm, self.dialog)
0.8.28 by Szilveszter Farkas (Phanatic)
Statistics menu added
228
        diff.display()
229
    
0.8.42 by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled.
230
    def on_menuitem_stats_infos_activate(self, widget):
231
        """ Statistics/Informations... menu handler. """
232
        from info import OliveInfo
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
233
        info = OliveInfo(self.gladefile, self.comm, self.dialog)
0.8.42 by Szilveszter Farkas (Phanatic)
Implemented Informations functionality; some bzrlib API changes handled.
234
        info.display()
235
    
0.8.43 by Szilveszter Farkas (Phanatic)
Implemented Log functionality (via bzrk).
236
    def on_menuitem_stats_log_activate(self, widget):
237
        """ Statistics/Log... menu handler. """
238
        from log import OliveLog
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
239
        log = OliveLog(self.gladefile, self.comm, self.dialog)
0.8.43 by Szilveszter Farkas (Phanatic)
Implemented Log functionality (via bzrk).
240
        log.display()
241
    
0.8.49 by Szilveszter Farkas (Phanatic)
Added View menu; implemented Refresh; some TODO changes.
242
    def on_menuitem_view_refresh_activate(self, widget):
243
        """ View/Refresh menu handler. """
244
        # Refresh the left pane
245
        self.comm.refresh_left()
246
        # Refresh the right pane
247
        self.comm.refresh_right()
248
    
249
    def on_menuitem_view_show_hidden_files_activate(self, widget):
250
        """ View/Show hidden files menu handler. """
251
        if widget.get_active():
252
            # Show hidden files
253
            self.comm.pref.set_preference('dotted_files', True)
254
            self.comm.pref.refresh()
255
            self.comm.refresh_right()
256
        else:
257
            # Do not show hidden files
258
            self.comm.pref.set_preference('dotted_files', False)
259
            self.comm.pref.refresh()
260
            self.comm.refresh_right()
261
0.8.33 by Szilveszter Farkas (Phanatic)
Implemented bookmarking.
262
    def on_treeview_left_button_press_event(self, widget, event):
263
        """ Occurs when somebody right-clicks in the bookmark list. """
264
        if event.button == 3:
265
            self.menu.left_context_menu().popup(None, None, None, 0,
0.8.41 by Szilveszter Farkas (Phanatic)
Main window preferences (size, position) are stored.
266
                                                event.time)
0.8.33 by Szilveszter Farkas (Phanatic)
Implemented bookmarking.
267
        
268
    def on_treeview_left_row_activated(self, treeview, path, view_column):
269
        """ Occurs when somebody double-clicks or enters an item in the
270
        bookmark list. """
271
        self.comm.set_busy(treeview)
272
        
273
        newdir = self.comm.get_selected_left()
274
        self.comm.set_path(newdir)
275
        
276
        self.comm.refresh_right()
277
        
278
        self.comm.set_busy(treeview, False)
279
    
0.8.24 by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list.
280
    def on_treeview_right_button_press_event(self, widget, event):
281
        """ Occurs when somebody right-clicks in the file list. """
282
        if event.button == 3:
0.8.53 by Szilveszter Farkas (Phanatic)
Set sensitivity of menus and toolbuttons.
283
            # get the menu items
284
            m_add = self.menu.ui.get_widget('/context_right/add')
285
            m_remove = self.menu.ui.get_widget('/context_right/remove')
286
            m_commit = self.menu.ui.get_widget('/context_right/commit')
287
            m_diff = self.menu.ui.get_widget('/context_right/diff')
288
            # check if we're in a branch
289
            if not is_branch(self.comm.get_path()):
290
                m_add.set_sensitive(False)
291
                m_remove.set_sensitive(False)
292
                m_commit.set_sensitive(False)
293
                m_diff.set_sensitive(False)
294
            else:
295
                m_add.set_sensitive(True)
296
                m_remove.set_sensitive(True)
297
                m_commit.set_sensitive(True)
298
                m_diff.set_sensitive(True)
0.8.24 by Szilveszter Farkas (Phanatic)
Implemented context menu for the file list.
299
            self.menu.right_context_menu().popup(None, None, None, 0,
300
                                                 event.time)
301
        
0.8.18 by Szilveszter Farkas (Phanatic)
2006-07-20 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
302
    def on_treeview_right_row_activated(self, treeview, path, view_column):
303
        """ Occurs when somebody double-clicks or enters an item in the
304
        file list. """
305
        import os.path
306
        
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
307
        newdir = self.comm.get_selected_right()
0.8.18 by Szilveszter Farkas (Phanatic)
2006-07-20 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
308
        
309
        if newdir == '..':
310
            self.comm.set_path(os.path.split(self.comm.get_path())[0])
311
        else:
0.8.54 by Szilveszter Farkas (Phanatic)
Fixed a bug when double-clicking a file.
312
            fullpath = self.comm.get_path() + '/' + newdir
313
            if os.path.isdir(fullpath):
314
                # selected item is an existant directory
315
                self.comm.set_path(fullpath)
316
            else:
317
                if sys.platform == 'win32':
318
                    # open the file with the default application
319
                    os.startfile(fullpath)
320
                else:
321
                    # TODO: support other OSes
322
                    print "DEBUG: double-click on non-Win32 platforms not supported."
0.8.18 by Szilveszter Farkas (Phanatic)
2006-07-20 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
323
        
324
        self.comm.refresh_right()
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
325
    
0.8.32 by Szilveszter Farkas (Phanatic)
Implemented OlivePreferences; some wording fixes.
326
    def on_window_main_delete_event(self, widget, event=None):
327
        """ Do some stuff before exiting. """
0.8.41 by Szilveszter Farkas (Phanatic)
Main window preferences (size, position) are stored.
328
        width, height = self.comm.window_main.get_size()
329
        self.comm.pref.set_preference('window_width', width)
330
        self.comm.pref.set_preference('window_height', height)
331
        x, y = self.comm.window_main.get_position()
332
        self.comm.pref.set_preference('window_x', x)
333
        self.comm.pref.set_preference('window_y', y)
334
        self.comm.pref.set_preference('paned_position',
335
                                      self.comm.hpaned_main.get_position())
336
        
0.8.32 by Szilveszter Farkas (Phanatic)
Implemented OlivePreferences; some wording fixes.
337
        self.comm.pref.write()
338
        self.comm.window_main.destroy()
339
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
340
    def not_implemented(self, widget):
341
        """ Display a Not implemented error message. """
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
342
        self.dialog.error_dialog(_('We feel sorry'),
343
                                 _('This feature is not yet implemented.'))
0.8.13 by Szilveszter Farkas (Phanatic)
2006-07-17 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
344