Switching to the GTK About dialog
authorEd Page <eopage@byu.net>
Fri, 30 Oct 2009 01:38:36 +0000 (20:38 -0500)
committerEd Page <eopage@byu.net>
Fri, 30 Oct 2009 01:38:36 +0000 (20:38 -0500)
data/gonvert.glade
src/gonvert_glade.py

index 7c036f1..dfafd67 100644 (file)
   </child>
 </widget>
 
-<widget class="GtkDialog" id="about_box">
-  <property name="title" translatable="yes">About</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">False</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <property name="has_separator">True</property>
-  <signal name="delete_event" handler="on_about_close_clicked" last_modification_time="Mon, 28 Jun 2004 23:42:53 GMT"/>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox1">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">0</property>
-
-      <child internal-child="action_area">
-       <widget class="GtkHButtonBox" id="dialog-action_area1">
-         <property name="visible">True</property>
-         <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-         <child>
-           <widget class="GtkButton" id="about_close">
-             <property name="visible">True</property>
-             <property name="can_default">True</property>
-             <property name="can_focus">True</property>
-             <property name="label">gtk-close</property>
-             <property name="use_stock">True</property>
-             <property name="relief">GTK_RELIEF_NORMAL</property>
-             <property name="focus_on_click">True</property>
-             <property name="response_id">-7</property>
-             <signal name="clicked" handler="on_about_close_clicked" last_modification_time="Sat, 22 Feb 2003 14:35:51 GMT"/>
-             <accelerator key="Escape" modifiers="0" signal="clicked"/>
-           </widget>
-         </child>
-       </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">False</property>
-         <property name="fill">True</property>
-         <property name="pack_type">GTK_PACK_END</property>
-       </packing>
-      </child>
-
-      <child>
-       <widget class="GtkImage" id="about_image">
-         <property name="visible">True</property>
-         <property name="xalign">0.5</property>
-         <property name="yalign">0.5</property>
-         <property name="xpad">0</property>
-         <property name="ypad">0</property>
-       </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">True</property>
-         <property name="fill">True</property>
-       </packing>
-      </child>
-
-      <child>
-       <widget class="GtkTable" id="table1">
-         <property name="visible">True</property>
-         <property name="n_rows">3</property>
-         <property name="n_columns">2</property>
-         <property name="homogeneous">False</property>
-         <property name="row_spacing">0</property>
-         <property name="column_spacing">0</property>
-
-         <child>
-           <widget class="GtkLabel" id="label7">
-             <property name="visible">True</property>
-             <property name="label" translatable="yes">Version:</property>
-             <property name="use_underline">False</property>
-             <property name="use_markup">False</property>
-             <property name="justify">GTK_JUSTIFY_LEFT</property>
-             <property name="wrap">False</property>
-             <property name="selectable">False</property>
-             <property name="xalign">1</property>
-             <property name="yalign">0.5</property>
-             <property name="xpad">0</property>
-             <property name="ypad">0</property>
-             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-             <property name="width_chars">-1</property>
-             <property name="single_line_mode">False</property>
-             <property name="angle">0</property>
-           </widget>
-           <packing>
-             <property name="left_attach">0</property>
-             <property name="right_attach">1</property>
-             <property name="top_attach">0</property>
-             <property name="bottom_attach">1</property>
-             <property name="x_options">fill</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkEntry" id="versionlabel">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="editable">False</property>
-             <property name="visibility">True</property>
-             <property name="max_length">0</property>
-             <property name="text" translatable="yes">x.x.x</property>
-             <property name="has_frame">True</property>
-             <property name="invisible_char">*</property>
-             <property name="activates_default">False</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">0</property>
-             <property name="bottom_attach">1</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkLabel" id="label5">
-             <property name="visible">True</property>
-             <property name="label" translatable="yes">Website:</property>
-             <property name="use_underline">False</property>
-             <property name="use_markup">False</property>
-             <property name="justify">GTK_JUSTIFY_LEFT</property>
-             <property name="wrap">False</property>
-             <property name="selectable">False</property>
-             <property name="xalign">1</property>
-             <property name="yalign">0.5</property>
-             <property name="xpad">0</property>
-             <property name="ypad">0</property>
-             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-             <property name="width_chars">-1</property>
-             <property name="single_line_mode">False</property>
-             <property name="angle">0</property>
-           </widget>
-           <packing>
-             <property name="left_attach">0</property>
-             <property name="right_attach">1</property>
-             <property name="top_attach">1</property>
-             <property name="bottom_attach">2</property>
-             <property name="x_options">fill</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkEntry" id="entry6">
-             <property name="width_request">363</property>
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="editable">False</property>
-             <property name="visibility">True</property>
-             <property name="max_length">0</property>
-             <property name="text" translatable="yes">http://unihedron.com/projects/gonvert/gonvert.php</property>
-             <property name="has_frame">True</property>
-             <property name="invisible_char">*</property>
-             <property name="activates_default">False</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">1</property>
-             <property name="bottom_attach">2</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkLabel" id="label6">
-             <property name="visible">True</property>
-             <property name="label" translatable="yes">Author:</property>
-             <property name="use_underline">False</property>
-             <property name="use_markup">False</property>
-             <property name="justify">GTK_JUSTIFY_LEFT</property>
-             <property name="wrap">False</property>
-             <property name="selectable">False</property>
-             <property name="xalign">1</property>
-             <property name="yalign">0.5</property>
-             <property name="xpad">0</property>
-             <property name="ypad">0</property>
-             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-             <property name="width_chars">-1</property>
-             <property name="single_line_mode">False</property>
-             <property name="angle">0</property>
-           </widget>
-           <packing>
-             <property name="left_attach">0</property>
-             <property name="right_attach">1</property>
-             <property name="top_attach">2</property>
-             <property name="bottom_attach">3</property>
-             <property name="x_options">fill</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-
-         <child>
-           <widget class="GtkEntry" id="entry7">
-             <property name="visible">True</property>
-             <property name="can_focus">True</property>
-             <property name="editable">False</property>
-             <property name="visibility">True</property>
-             <property name="max_length">0</property>
-             <property name="text" translatable="yes">Anthony Tekatch    anthony@unihedron.com</property>
-             <property name="has_frame">True</property>
-             <property name="invisible_char">*</property>
-             <property name="activates_default">False</property>
-           </widget>
-           <packing>
-             <property name="left_attach">1</property>
-             <property name="right_attach">2</property>
-             <property name="top_attach">2</property>
-             <property name="bottom_attach">3</property>
-             <property name="y_options"></property>
-           </packing>
-         </child>
-       </widget>
-       <packing>
-         <property name="padding">0</property>
-         <property name="expand">True</property>
-         <property name="fill">True</property>
-       </packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
 <widget class="GtkDialog" id="msgbox">
   <property name="title" translatable="yes">message box</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
index b8118de..6d88863 100755 (executable)
@@ -85,15 +85,9 @@ class Gonvert(object):
                self._unitValue = widgets.get_widget('unitValue')
                self._previousUnitName = widgets.get_widget('previousUnitName')
                self._previousUnitValue = widgets.get_widget('previousUnitValue')
-               self._about_box = widgets.get_widget('about_box')
                messagebox = widgets.get_widget('msgbox')
                messageboxtext = widgets.get_widget('msgboxtext')
 
-               about_image = widgets.get_widget('about_image')
-               about_image.set_from_file(pixmapspath +'gonvert.png')
-               versionlabel = widgets.get_widget('versionlabel')
-               versionlabel.set_text(constants.__version__)
-
                self._unitSymbol = widgets.get_widget('unitSymbol')
                self._previousUnitSymbol = widgets.get_widget('previousUnitSymbol')
 
@@ -161,7 +155,6 @@ class Gonvert(object):
                        "on_findEntry_key_press_event": self._on_find_key_press,
                        "on_findEntry_changed": self._findEntry_changed,
                        "on_aboutMenuItem_activate": self._on_about_clicked,
-                       "on_about_close_clicked": self._on_about_hide,
                        "on_messagebox_ok_clicked": self.messagebox_ok_clicked,
                        "on_clearSelectionMenuItem_activate": self._on_user_clear_selections,
                        "on_unitsView_cursor_changed": self._on_click_unit,
@@ -292,14 +285,18 @@ class Gonvert(object):
                        #Check if the key pressed was the 'Enter' key
                        if ord(b.string[0]) == 13:
                                #Execute the find units function
-                               _on_user_find_units(1)
+                               self._on_user_find_units(1)
 
        def _on_about_clicked(self, a):
-               self._about_box.show()
-
-       def _on_about_hide(self, *args):
-               self._about_box.hide()
-               return gtk.TRUE
+               dlg = gtk.AboutDialog()
+               dlg.set_name(constants.__pretty_app_name__)
+               dlg.set_version("%s-%d" % (constants.__version__, constants.__build__))
+               dlg.set_copyright("Copyright 2009 - GPL")
+               dlg.set_comments("")
+               dlg.set_website("http://unihedron.com/projects/gonvert/gonvert.php")
+               dlg.set_authors(["Anthony Tekatch <anthony@unihedron.com>", "Ed Page <edpage@byu.net>"])
+               dlg.run()
+               dlg.destroy()
 
        def messagebox_ok_clicked(self, a):
                messagebox.hide()