[Pkg-bazaar-commits] ./bzr-gtk/unstable r53: Add framework for commit dialog

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:16:08 UTC 2009


------------------------------------------------------------
revno: 53
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr-gtk
timestamp: Sat 2006-05-20 00:45:58 +0200
message:
  Add framework for commit dialog
added:
  commit/
  commit/__init__.py
  commit/gcommit.py
-------------- next part --------------
=== added directory 'commit'
=== added file 'commit/__init__.py'
--- a/commit/__init__.py	1970-01-01 00:00:00 +0000
+++ b/commit/__init__.py	2006-05-19 22:45:58 +0000
@@ -0,0 +1,64 @@
+# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+__version__ = "0.8"
+__author__ = "Jelmer Vernooij <jelmer at samba.org>"
+
+from bzrlib.workingtree import WorkingTree
+from bzrlib.commands import Command, register_command
+from bzrlib.commit import Commit
+from bzrlib.errors import (BzrCommandError, PointlessCommit, ConflictsInTree, 
+           StrictCommitFailed)
+
+class cmd_gcommit(Command):
+    """GTK+ commit dialog
+
+    Graphical user interface for committing revisions"""
+    
+    takes_args = []
+    takes_options = []
+
+    def run(self, filename=None):
+        import pygtk
+        pygtk.require("2.0")
+
+        try:
+            import gtk
+        except RuntimeError, e:
+            if str(e) == "could not open display":
+                raise NoDisplayError
+
+        from gcommit import GCommitDialog
+
+        (wt, path) = WorkingTree.open_containing(filename)
+        branch = wt.branch
+
+        file_id = wt.path2id(path)
+
+        if file_id is None:
+            raise NotVersionedError(filename)
+
+        dialog = GCommitDialog()
+        dialog.connect("destroy", lambda w: gtk.main_quit())
+        dialog.set_title(path + " - Commit")
+        dialog.show()
+
+        gtk.main()
+
+        Commit().commit(working_tree=wt,message=dialog.message,
+                specific_files=dialog.specific_files)
+
+register_command(cmd_gcommit)

=== added file 'commit/gcommit.py'
--- a/commit/gcommit.py	1970-01-01 00:00:00 +0000
+++ b/commit/gcommit.py	2006-05-19 22:45:58 +0000
@@ -0,0 +1,32 @@
+# Copyright (C) 2006 Jelmer Vernooij <jelmer at samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+import pygtk
+pygtk.require("2.0")
+import gobject
+import gtk
+import pango
+
+class GCommitDialog(gtk.Window):
+    """ Commit Dialog """
+
+    def __init__(self):
+        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+
+        self._create()
+
+    def _create(self):
+        pass



More information about the Pkg-bazaar-commits mailing list