[Pkg-bazaar-commits] ./bzr-gtk/unstable r618: Merge window type fix from Vincent.
Jelmer Vernooij
jelmer at samba.org
Fri Apr 10 07:44:23 UTC 2009
------------------------------------------------------------
revno: 618
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2008-10-28 16:14:30 +0100
message:
Merge window type fix from Vincent.
modified:
__init__.py
status.py
window.py
------------------------------------------------------------
revno: 614.1.1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 131589-window-for-gstatus
timestamp: Thu 2008-10-23 10:14:59 +0200
message:
Fix bug #131589 by using a gtk.Window instead of a gtk.Dialog.
* status.py:
(StatusWindow): Renamed from StatusDialog, we're a window now.
(StatusWindow.__init__, StatusWindow._create): Adjusted to Window
inheritance.
* __init__.py:
(cmd_gstatus.run): Use a Window instead of a dialog.
modified:
__init__.py
status.py
window.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2008-08-06 14:35:39 +0000
+++ b/__init__.py 2008-10-23 08:14:59 +0000
@@ -402,7 +402,7 @@
Graphical user interface for showing status
information."""
-
+
aliases = [ "gst" ]
takes_args = ['PATH?']
takes_options = ['revision']
@@ -410,21 +410,23 @@
def run(self, path='.', revision=None):
import os
gtk = open_display()
- from status import StatusDialog
+ from bzrlib.plugins.gtk.status import StatusWindow
(wt, wt_path) = workingtree.WorkingTree.open_containing(path)
-
+
if revision is not None:
try:
revision_id = revision[0].as_revision_id(wt.branch)
except:
from bzrlib.errors import BzrError
- raise BzrError('Revision %r doesn\'t exist' % revision[0].user_spec )
+ raise BzrError('Revision %r doesn\'t exist'
+ % revision[0].user_spec )
else:
revision_id = None
- status = StatusDialog(wt, wt_path, revision_id)
+ status = StatusWindow(wt, wt_path, revision_id)
status.connect("destroy", gtk.main_quit)
- status.run()
+ status.show()
+ gtk.main()
class cmd_gsend(GTKCommand):
=== modified file 'status.py'
--- a/status.py 2008-07-08 21:40:38 +0000
+++ b/status.py 2008-10-23 08:14:59 +0000
@@ -21,23 +21,25 @@
pass
import gtk
-from bzrlib.plugins.gtk import _i18n
-
-
-class StatusDialog(gtk.Dialog):
+from bzrlib.plugins.gtk import (
+ _i18n,
+ window,
+ )
+
+
+class StatusWindow(window.Window):
""" Display Status window and perform the needed actions. """
def __init__(self, wt, wtpath, revision=None):
""" Initialize the Status window. """
- super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
+ super(StatusWindow, self).__init__()
self.set_title("Working tree changes")
- self.set_default_response(gtk.RESPONSE_CLOSE)
self._create()
self.wt = wt
self.wtpath = wtpath
if revision is None:
revision = self.wt.branch.last_revision()
-
+
# Set the old working tree
self.old_tree = self.wt.branch.repository.revision_tree(revision)
# Generate status output
@@ -45,20 +47,17 @@
def _create(self):
self.set_default_size(400, 300)
- self.set_has_separator(False)
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
sw.set_shadow_type(gtk.SHADOW_IN)
self.treeview = gtk.TreeView()
sw.add(self.treeview)
- self.vbox.pack_start(sw, True, True)
- self.vbox.show_all()
+ self.add(sw)
# sane border and spacing widths (as recommended by GNOME HIG)
self.set_border_width(5)
sw.set_border_width(5)
- self.vbox.set_spacing(2)
- self.action_area.set_border_width(5)
+ self.show_all()
def row_diff(self, tv, path, tvc):
@@ -78,18 +77,18 @@
self.treeview.set_headers_visible(False)
self.treeview.set_model(self.model)
self.treeview.connect("row-activated", self.row_diff)
-
+
cell = gtk.CellRendererText()
cell.set_property("width-chars", 20)
column = gtk.TreeViewColumn()
column.pack_start(cell, expand=True)
column.add_attribute(cell, "text", 0)
self.treeview.append_column(column)
-
+
delta = self.wt.changes_from(self.old_tree)
changes = False
-
+
if len(delta.added):
changes = True
titer = self.model.append(None, [ _i18n('Added'), None ])
@@ -114,7 +113,7 @@
titer = self.model.append(None, [ _i18n('Modified'), None ])
for path, id, kind, text_modified, meta_modified in delta.modified:
self.model.append(titer, [ path, path ])
-
+
done_unknown = False
for path in self.wt.unknowns():
changes = True
@@ -127,6 +126,6 @@
self.model.append(None, [ _i18n('No changes.'), None ])
self.treeview.expand_all()
-
+
def close(self, widget=None):
self.window.destroy()
=== modified file 'window.py'
--- a/window.py 2007-10-14 15:54:57 +0000
+++ b/window.py 2008-10-23 08:14:59 +0000
@@ -7,9 +7,9 @@
def __init__(self, parent=None):
gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
self._parent = parent
-
+
self.connect('key-press-event', self._on_key_press)
-
+
def _on_key_press(self, widget, event):
keyname = gtk.gdk.keyval_name(event.keyval)
if event.state & gtk.gdk.CONTROL_MASK:
More information about the Pkg-bazaar-commits
mailing list