[d-feet] Add a bus-address command line option
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [d-feet] Add a bus-address command line option
- Date: Mon, 23 Aug 2010 18:24:18 +0000 (UTC)
commit 4b2ddba8cdb674d1eeb178bc7e212605a2652b5f
Author: Johan Dahlin <johan gnome org>
Date: Mon Aug 16 17:15:32 2010 -0300
Add a bus-address command line option
d-feet | 4 ++++
dfeet/DFeetApp.py | 10 ++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/d-feet b/d-feet
index dbd92bf..8f6383f 100755
--- a/d-feet
+++ b/d-feet
@@ -19,6 +19,8 @@ parser = optparse.OptionParser(usage="%prog [options] [project-file]")
parser.add_option("-l", "--local-dirs", action="store_true", dest="use_local_dirs",
help="Use files from the local directory tree")
+parser.add_option("-a", "--bus-address", action="store", dest="bus_address",
+ help="Bus address to connect to", default=None)
(options, args) = parser.parse_args()
if options.use_local_dirs:
@@ -45,4 +47,6 @@ import dfeet.DFeetApp as DFeetApp
#Launch the program
app = DFeetApp.DFeetApp()
+if options.bus_address is not None:
+ app.select_or_add_bus(address=options.bus_address)
DFeetApp.gtk.main()
diff --git a/dfeet/DFeetApp.py b/dfeet/DFeetApp.py
index c4687ab..e8d17c8 100644
--- a/dfeet/DFeetApp.py
+++ b/dfeet/DFeetApp.py
@@ -97,6 +97,16 @@ class DFeetApp:
n = self.notebook.page_num(child)
self.notebook.remove_page(n)
+ def select_or_add_bus(self, address):
+ for i in range(self.notebook.get_n_pages()):
+ page = self.notebook.get_nth_page(i)
+ tab_label = self.notebook.get_tab_label(page)
+ if tab_label.get_children()[0].get_text() == address:
+ self.notebook.set_current_page(i)
+ break
+ else:
+ self.add_bus(address=address)
+
def add_bus(self, bus_type=None, address=None):
if bus_type == dbus_introspector.SESSION_BUS or bus_type == dbus_introspector.SYSTEM_BUS:
bus_watch = BusWatch(bus_type)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]