[gevice] changed properties of some widgets
- From: Alejandro Valdes Jimenez <avaldes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gevice] changed properties of some widgets
- Date: Mon, 25 Jul 2011 18:56:48 +0000 (UTC)
commit 1c615755ad6659866fe1e0642690279c48892f90
Author: Alejandro Valdes Jimenez <avaldes gnome org>
Date: Mon Jul 25 14:50:44 2011 -0400
changed properties of some widgets
ChangeLog | 4 +
data/ui/main.xml | 66 +++++++------------
src/gevice.py | 194 ++++++++++++++++++++++++------------------------------
3 files changed, 113 insertions(+), 151 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5c2e468..3a23f7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
2011-07-25 Alejandro Valdes Jimenez <avaldes gnome org>
+ * data/ui/main.xml: changed properties of some widgets
+ * src/gevice.py: rewrite code
+
+2011-07-25 Alejandro Valdes Jimenez <avaldes gnome org>
* data/ui/main.xml: add new file
2011-07-25 Alejandro Valdes Jimenez <avaldes gnome org>
diff --git a/data/ui/main.xml b/data/ui/main.xml
index bae6e26..8e345ff 100644
--- a/data/ui/main.xml
+++ b/data/ui/main.xml
@@ -1,49 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 2.6 -->
- <object class="GtkListStore" id="model1">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">dot</col>
- </row>
- <row>
- <col id="0" translatable="yes">neato</col>
- </row>
- <row>
- <col id="0" translatable="yes">circo</col>
- </row>
- <row>
- <col id="0" translatable="yes">twopi</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model2">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">png</col>
- </row>
- <row>
- <col id="0" translatable="yes">jpg</col>
- </row>
- <row>
- <col id="0" translatable="yes">gif</col>
- </row>
- <row>
- <col id="0" translatable="yes">svg</col>
- </row>
- </data>
- </object>
<object class="GtkWindow" id="window_main">
- <property name="width_request">700</property>
- <property name="height_request">500</property>
+ <property name="width_request">800</property>
+ <property name="height_request">400</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Gevice</property>
<property name="window_position">center</property>
@@ -53,9 +13,28 @@
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkStatusbar" id="statusbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHPaned" id="hpaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="position">1</property>
+ <property name="position_set">True</property>
<child>
<object class="GtkVBox" id="vboxtreeview">
<property name="height_request">60</property>
@@ -95,7 +74,8 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/src/gevice.py b/src/gevice.py
index 38b5bfb..9f89cbd 100755
--- a/src/gevice.py
+++ b/src/gevice.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/python
#
# gevice GNOME Network Device Manager.
@@ -54,38 +53,99 @@ class Gevice:
self.list_location = None
self.connected_to_database = False
self.context_id = None
- self.modelusers = gtk.ListStore(gobject.TYPE_STRING)
-
- self.statusicon = gtk.StatusIcon()
- self.statusicon.set_from_stock(gtk.STOCK_DIALOG_WARNING)
- self.statusicon.set_tooltip("Esta es una advertencia")
- self.statusicon.set_visible(False)
- self.statusicon.set_blinking(True)
- # get model for devices
+ # model for users
+ self.modelusers = gtk.ListStore(gobject.TYPE_STRING)
+
+ # model for devices
self.gmodel = gevicemodel.GeviceModel(self)
- # create main window
- self.window_main = gtk.Window()
- self.window_main.set_position(1)
- self.window_main.set_default_size(800,600)
- ###self.window_main.maximize()
- self.window_main.set_title (config.PACKAGE)
- self.window_main.set_icon (gtk.gdk.pixbuf_new_from_file(os.path.join (config.ARTDIR,"gevice.png")))
- self.window_main.connect ("delete_event",self.on_delete_event)
+ # get widgets of main app
+ builder = gtk.Builder()
+ builder.add_from_file(os.path.join (config.UIDIR, "main.xml"))
+
+ self.window_main = builder.get_object ("window_main")
+ self.vbox_main = builder.get_object ("vbox_main")
+ self.hpaned = builder.get_object ("hpaned")
+ self.vboxtreeview = builder.get_object ("vboxtreeview")
+ self.vboxterminal = builder.get_object ("vboxterminal")
+ self.notebook = builder.get_object ("notebook")
+ self.statusbar = builder.get_object ("statusbar")
+
+ self.window_main.set_icon (gtk.gdk.pixbuf_new_from_file(os.path.join (config.ARTDIR,"gevice.png")))
+ self.window_main.set_title(config.PACKAGE)
+ self.window_main.connect ("delete_event",self.on_delete_event)
+
+ self.context_id = self.statusbar.get_context_id("status")
+
+ # create UIManager instance
+ self.uimanager = gtk.UIManager()
+ self.uimanager.add_ui_from_file (os.path.join (config.UIDIR, "menu.xml"))
- # create main container
- self.vbox = gtk.VBox(False,0)
- self.window_main.add (self.vbox)
+ # create ActionGroup and add to unimanager
+ self.create_actionsgroups ()
+
+ # add the actiongroup to the uimanager
+ self.uimanager.insert_action_group (self.actiongroup_window,0)
+ self.uimanager.insert_action_group (self.actiongroup_model,0)
+ self.uimanager.insert_action_group (self.actiongroup_device,0)
+
+ # create MenuBar
+ self.menubar = self.uimanager.get_widget ('/MainMenu')
+ self.vbox_main.pack_start (self.menubar,False,False,0)
+
+ # create a Toolbar
+ self.maintoolbar = self.uimanager.get_widget ('/MainToolbar')
+ self.maintoolbar.set_style(gtk.TOOLBAR_ICONS)
+
+ # create horizontal container for toolbar and users combobox
+ self.hbox = gtk.HBox(False,0)
+ self.vbox_main.pack_start (self.hbox,False,False,0)
- # create an ActionGroup
+ # create users combobox
+ self.separator_user = gtk.SeparatorToolItem()
+ self.toolitem_user = gtk.ToolItem()
+ self.maintoolbar.insert(self.toolitem_user,12)
+
+ self.vboxcombo = gtk.VBox(False,0)
+ self.combobox_user = gtk.combo_box_entry_new_with_model(self.modelusers,0)
+ self.vboxcombo.pack_end (self.combobox_user,True,False)
+ self.toolitem_user.add(self.vboxcombo)
+
+ self.hbox.pack_start (self.maintoolbar,True,True)
+
+ # add treeview to vboxtreeview
+ self.scroll = gtk.ScrolledWindow()
+ self.scroll.set_shadow_type("GTK_SHADOW_ETCHED_IN")
+ self.scroll.set_policy("GTK_POLICY_AUTOMATIC","GTK_POLICY_AUTOMATIC")
+ self.scroll.add (self.gmodel.treeview)
+ self.vboxtreeview.add (self.scroll)
+
+ # setting notebook properties
+ self.notebook.set_scrollable (True)
+ self.notebook.set_show_border (False)
+ self.notebook.set_show_tabs (True)
+ self.notebook.set_group_id(1)
+
+ self.hpaned.add2 (self.notebook)
+ # a negative value means that the position is unset.
+ self.hpaned.set_position (-1)
+
+ # load preferences
+ ###self.gpref = geviceprefer.GevicePrefer(self)
+ ###self.gpref.load_preferences(self)
+ ###self.gpref.load_interface (self)
+ ###self.set_listusers_on_combobox()
+
+ # show all
+ self.window_main.show_all()
+ return
+
+ def create_actionsgroups (self):
self.actiongroup_window = gtk.ActionGroup ('Window Actions')
self.actiongroup_model = gtk.ActionGroup ('Model Actions')
self.actiongroup_device = gtk.ActionGroup ('Device Actions')
- # create a UIManager instance
- self.uimanager = gtk.UIManager()
-
# add the accelerator group to the toplevel window
self.accelgroup = self.uimanager.get_accel_group()
self.window_main.add_accel_group (self.accelgroup)
@@ -148,91 +208,9 @@ class Gevice:
('Connect', gtk.STOCK_JUMP_TO, _('Connect'), None, _('Connect to'), self.on_action_connect),
])
- # add the actiongroup to the uimanager
- self.uimanager.insert_action_group (self.actiongroup_window,0)
- self.uimanager.insert_action_group (self.actiongroup_model,0)
- self.uimanager.insert_action_group (self.actiongroup_device,0)
-
- # add a UI description
- self.uimanager.add_ui_from_file (os.path.join (config.UIDIR, "menu.xml"))
-
- # create a MenuBar
- self.menubar = self.uimanager.get_widget ('/MainMenu')
- self.vbox.pack_start (self.menubar,False,False,0)
-
- # create horizontal container for toolbar and combobox
- self.hbox = gtk.HBox(False,0)
- self.vbox.pack_start (self.hbox,False,False,0)
-
- # create a Toolbar
- self.maintoolbar = self.uimanager.get_widget ('/MainToolbar')
- self.maintoolbar.set_style(gtk.TOOLBAR_ICONS)
- #self.maintoolbar.set_style(gtk.TOOLBAR_BOTH)
-
- ## create combobox user
- self.separator_user = gtk.SeparatorToolItem()
- self.toolitem_user = gtk.ToolItem()
- self.maintoolbar.insert(self.toolitem_user,12)
-
- self.vboxcombo = gtk.VBox(False,0)
- self.combobox_user = gtk.combo_box_entry_new_with_model(self.modelusers,0)
- self.vboxcombo.pack_end (self.combobox_user,True,False)
- self.toolitem_user.add(self.vboxcombo)
-
- self.hbox.pack_start (self.maintoolbar,True,True)
-
+ self.actiongroup_model.set_sensitive (False)
self.actiongroup_window.set_sensitive (True)
- self.actiongroup_model.set_sensitive (False)
- self.actiongroup_device.set_sensitive (False)
-
- # get widgets of main app
- builder = gtk.Builder()
- builder.add_from_file(os.path.join (config.UIDIR, "main.xml"))
- self.vbox_main = builder.get_object ("vbox_main")
- self.hpaned = builder.get_object ("hpaned")
- self.vboxtreeview = builder.get_object ("vboxtreeview")
- self.vboxterminal = builder.get_object ("vboxterminal")
- self.notebook = builder.get_object ("notebook")
-
- # add treeview to vboxtreeview
- self.scroll = gtk.ScrolledWindow()
- self.scroll.set_shadow_type("GTK_SHADOW_ETCHED_IN")
- self.scroll.set_policy("GTK_POLICY_AUTOMATIC","GTK_POLICY_AUTOMATIC")
- self.scroll.add (self.gmodel.treeview)
- self.vboxtreeview.add (self.scroll)
-
- # create notebook
- self.notebook.set_scrollable (True)
- self.notebook.set_show_border (False)
- self.notebook.set_show_tabs (True)
- self.notebook.set_group_id(1)
-
- self.hpaned.add2 (self.notebook)
- # a negative value means that the position is unset.
- self.hpaned.set_position (-1)
-
- self.vbox.pack_start (self.vbox_main, False)
- self.vbox.set_child_packing (self.vbox_main,True,True,0,gtk.PACK_START)
-
- # create statusbar
- hbox_status = gtk.HBox(False,0)
- self.statusbar = gtk.Statusbar()
- hbox_status.pack_start(self.statusbar, True)
- self.vbox.pack_start (hbox_status, False)
- self.context_id = self.statusbar.get_context_id("status")
-
- self.actiongroup_model.set_sensitive (False)
- self.window_main.set_title(config.PACKAGE)
-
- # load preferences
- ###self.gpref = geviceprefer.GevicePrefer(self)
- ###self.gpref.load_preferences(self)
- ###self.gpref.load_interface (self)
- ###self.set_listusers_on_combobox()
-
- # show all
- self.window_main.show_all()
- return
+ self.actiongroup_device.set_sensitive (False)
def set_listusers_on_combobox (self):
self.modelusers.clear()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]