Rev 1: Basic dialog for selecting a patch to merge into a branch. in http://bzr.arbash-meinel.com/branches/bzr/merge_into
John Arbash Meinel
john at arbash-meinel.com
Fri Dec 21 19:25:36 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/merge_into
------------------------------------------------------------
revno: 1
revision-id:john at arbash-meinel.com-20071221192530-564ucjewkx5g3s9z
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_into
timestamp: Fri 2007-12-21 13:25:30 -0600
message:
Basic dialog for selecting a patch to merge into a branch.
added:
bzr_merge_into.py bzr_merge_into.py-20071221192513-1fyh868lls6qugcq-1
bzr_merge_into.wxg bzr_merge_into.wxg-20071221185509-khngkqvqe1jjzb2i-1
-------------- next part --------------
=== added file 'bzr_merge_into.py'
--- a/bzr_merge_into.py 1970-01-01 00:00:00 +0000
+++ b/bzr_merge_into.py 2007-12-21 19:25:30 +0000
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007 Canonical Ltd
+#
+# 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
+
+"""A simple helper GUI for merging patches into branches."""
+
+import os
+
+import wx
+
+
+class MergeIntoFrame(wx.Frame):
+ def __init__(self, *args, **kwds):
+ # begin wxGlade: MergeIntoFrame.__init__
+ kwds["style"] = wx.DEFAULT_FRAME_STYLE
+ wx.Frame.__init__(self, *args, **kwds)
+ self.label_1 = wx.StaticText(self, -1, "Patch Location")
+ self.btn_browse_patch = wx.Button(self, -1, "Browse")
+ self.text_merge_patch = wx.TextCtrl(self, -1, "")
+ self.label_2 = wx.StaticText(self, -1, "Target Branch")
+ self.btn_browse_branch = wx.Button(self, -1, "Browse")
+ self.text_target_branch = wx.TextCtrl(self, -1, "/home/jameinel/dev/bzr/jam-integration")
+ self.button_1 = wx.Button(self, wx.ID_CANCEL, "")
+ self.btn_ok = wx.Button(self, wx.ID_OK, "")
+
+ self.__set_properties()
+ self.__do_layout()
+
+ self.Bind(wx.EVT_BUTTON, self.onButtonBrowsePatch, self.btn_browse_patch)
+ self.Bind(wx.EVT_BUTTON, self.onButtonBrowseBranch, self.btn_browse_branch)
+ self.Bind(wx.EVT_BUTTON, self.onCancel, self.button_1)
+ self.Bind(wx.EVT_BUTTON, self.onOk, self.btn_ok)
+ # end wxGlade
+
+ def __set_properties(self):
+ # begin wxGlade: MergeIntoFrame.__set_properties
+ self.SetTitle("Bzr Merge Into")
+ self.SetSize((400, 180))
+ # end wxGlade
+
+ def __do_layout(self):
+ # begin wxGlade: MergeIntoFrame.__do_layout
+ sizer_1 = wx.BoxSizer(wx.VERTICAL)
+ sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
+ sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
+ sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
+ sizer_2.Add(self.label_1, 0, wx.ALIGN_BOTTOM, 0)
+ sizer_2.Add((10, 10), 1, 0, 0)
+ sizer_2.Add(self.btn_browse_patch, 0, 0, 0)
+ sizer_1.Add(sizer_2, 0, wx.ALL|wx.EXPAND, 3)
+ sizer_1.Add(self.text_merge_patch, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 3)
+ sizer_3.Add(self.label_2, 0, wx.ALIGN_BOTTOM, 0)
+ sizer_3.Add((10, 10), 1, 0, 0)
+ sizer_3.Add(self.btn_browse_branch, 0, 0, 0)
+ sizer_1.Add(sizer_3, 0, wx.ALL|wx.EXPAND, 3)
+ sizer_1.Add(self.text_target_branch, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 3)
+ sizer_4.Add((10, 10), 1, 0, 0)
+ sizer_4.Add(self.button_1, 0, wx.ALL, 5)
+ sizer_4.Add(self.btn_ok, 0, wx.ALL, 5)
+ sizer_1.Add(sizer_4, 1, wx.EXPAND, 0)
+ self.SetSizer(sizer_1)
+ self.Layout()
+ # end wxGlade
+
+ def onButtonBrowsePatch(self, event): # wxGlade: MergeIntoFrame.<event_handler>
+ dlg = wx.FileDialog(self, message='Select a patch to be merged',
+ wildcard='Bazaar Patch (*.patch,*.diff,*.bundle)'
+ '|*.patch;*.diff;*.bundle'
+ '|All Files (*.*)|*')
+ if dlg.ShowModal() == wx.ID_OK:
+ directory = dlg.GetDirectory()
+ fname = dlg.GetFilename()
+ path = os.path.join(directory, fname)
+ self.text_merge_patch.SetValue(path)
+
+ def onButtonBrowseBranch(self, event): # wxGlade: MergeIntoFrame.<event_handler>
+ print "Event handler `onButtonBrowseBranch' not implemented!"
+ event.Skip()
+
+ def onCancel(self, event): # wxGlade: MergeIntoFrame.<event_handler>
+ self.Close()
+
+ def onOk(self, event): # wxGlade: MergeIntoFrame.<event_handler>
+ print "Event handler `onOk' not implemented!"
+ event.Skip()
+
+# end of class MergeIntoFrame
+
+
+class MergeIntoApp(wx.App):
+ def OnInit(self):
+ wx.InitAllImageHandlers()
+ merge_into = MergeIntoFrame(None, -1, "")
+ self.SetTopWindow(merge_into)
+ merge_into.Show()
+ return 1
+
+# end of class MergeIntoApp
+
+if __name__ == "__main__":
+ app = MergeIntoApp(0)
+ app.MainLoop()
=== added file 'bzr_merge_into.wxg'
--- a/bzr_merge_into.wxg 1970-01-01 00:00:00 +0000
+++ b/bzr_merge_into.wxg 2007-12-21 19:25:30 +0000
@@ -0,0 +1,138 @@
+<?xml version="1.0"?>
+<!-- generated by wxGlade 0.5 on Fri Dec 21 13:20:57 2007 -->
+
+<application path="bzr_merge_into.py" name="" class="MergeIntoApp" option="0" language="python" top_window="merge_into" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
+ <object class="MergeIntoFrame" name="merge_into" base="EditFrame">
+ <style>wxDEFAULT_FRAME_STYLE</style>
+ <title>Bzr Merge Into</title>
+ <size>400, 180</size>
+ <object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <object class="sizeritem">
+ <flag>wxALL|wxEXPAND</flag>
+ <border>3</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALIGN_BOTTOM</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticText" name="label_1" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Patch Location</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>1</option>
+ <object class="spacer" name="spacer" base="EditSpacer">
+ <height>10</height>
+ <width>10</width>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxButton" name="btn_browse_patch" base="EditButton">
+ <label>Browse</label>
+ <events>
+ <handler event="EVT_BUTTON">onButtonBrowsePatch</handler>
+ </events>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND</flag>
+ <border>3</border>
+ <option>0</option>
+ <object class="wxTextCtrl" name="text_merge_target" base="EditTextCtrl">
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL|wxEXPAND</flag>
+ <border>3</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALIGN_BOTTOM</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticText" name="label_2" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Target Branch</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>1</option>
+ <object class="spacer" name="spacer" base="EditSpacer">
+ <height>10</height>
+ <width>10</width>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxButton" name="btn_browse_branch" base="EditButton">
+ <label>Browse</label>
+ <events>
+ <handler event="EVT_BUTTON">onButtonBrowseBranch</handler>
+ </events>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND</flag>
+ <border>3</border>
+ <option>0</option>
+ <object class="wxTextCtrl" name="text_target_branch" base="EditTextCtrl">
+ <value>/home/jameinel/dev/bzr/jam-integration</value>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="wxBoxSizer" name="sizer_4" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>1</option>
+ <object class="spacer" name="spacer" base="EditSpacer">
+ <height>10</height>
+ <width>10</width>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL</flag>
+ <border>5</border>
+ <option>0</option>
+ <object class="wxButton" name="button_1" base="EditButton">
+ <stockitem>CANCEL</stockitem>
+ <label>&Cancel</label>
+ <events>
+ <handler event="EVT_BUTTON">onCancel</handler>
+ </events>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL</flag>
+ <border>5</border>
+ <option>0</option>
+ <object class="wxButton" name="btn_ok" base="EditButton">
+ <stockitem>OK</stockitem>
+ <label>&OK</label>
+ <events>
+ <handler event="EVT_BUTTON">onOk</handler>
+ </events>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+</application>
More information about the bazaar-commits
mailing list