[pybliographer/gtk3: 9/25] openurl: Port dialog to gtk+3



commit 9af611736d001c91244801da57a7627b30024f14
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Thu May 30 19:56:22 2013 -0700

    openurl: Port dialog to gtk+3
    
    Signed-off-by: Germán Poo-Caamaño <gpoo gnome org>

 Pyblio/GnomeUI/OpenURL.py          |   40 ++++----
 Pyblio/GnomeUI/glade/openurl.glade |  169 ------------------------------------
 Pyblio/GnomeUI/glade/openurl.ui    |  141 ++++++++++++++++++++++++++++++
 3 files changed, 161 insertions(+), 189 deletions(-)
---
diff --git a/Pyblio/GnomeUI/OpenURL.py b/Pyblio/GnomeUI/OpenURL.py
index 97a0365..ebe75fc 100644
--- a/Pyblio/GnomeUI/OpenURL.py
+++ b/Pyblio/GnomeUI/OpenURL.py
@@ -1,7 +1,8 @@
+# -*- coding: utf-8 -*-
 # This file is part of pybliographer
 # 
-# Copyright (C) 1998-2004 Frederic GOBRY
-# Email : gobry pybliographer org
+# Copyright (C) 1998-2004 Frederic GOBRY <gobry pybliographer org>
+# Copyright (C) 2013 Germán Poo-Caamaño <gpoo gnome org>
 #         
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -23,7 +24,6 @@
 
 from gi.repository import GObject
 from gi.repository import Gtk
-# from gnome import ui
 
 import string, os
 
@@ -35,37 +35,37 @@ class OpenDialog (Connector.Publisher, Utils.GladeWindow):
 
     """ Class implementing the Open Location dialog """
 
-    gladeinfo = { 'file': 'openurl.glade',
+    gladeinfo = { 'file': 'openurl.ui',
                   'root': '_w_openurl',
                   'name': 'openurl'
                   }
 
-    def __init__ (self, parent = None, has_auto = True):
+    def __init__(self, parent=None, has_auto=True):
 
-        Utils.GladeWindow.__init__ (self, parent)
+        Utils.GladeWindow.__init__(self, parent)
 
-        liststore = Gtk.ListStore (GObject.TYPE_STRING)
+        liststore = Gtk.ListStore(GObject.TYPE_STRING)
         menu = self._w_combobox
-        menu.set_model (liststore)
+        menu.set_model(liststore)
         cell = Gtk.CellRendererText()
         menu.pack_start(cell, True)
         menu.add_attribute(cell, 'text', 0)
 
-        liste = Autoload.available ('format')
+        liste = Autoload.available('format')
         liste.sort ()
 
         self.formats = [ None ]
 
         if has_auto:
-            iter = liststore.append ()
+            iter = liststore.append()
             liststore.set (iter, 0, _(' - According to file suffix - '))
             self.ftype = None
         else:
-            self.ftype = liste [0]
+            self.ftype = liste[0]
 
         for avail in liste:
-            iter = liststore.append ()
-            liststore.set (iter, 0, avail)
+            iter = liststore.append()
+            liststore.set(iter, 0, avail)
 
         self.formats += liste
 
@@ -74,20 +74,20 @@ class OpenDialog (Connector.Publisher, Utils.GladeWindow):
         return
 
 
-    def menu_select (self, widget):
-        self.ftype = self.formats [widget.get_active ()]
+    def menu_select(self, widget):
+        self.ftype = self.formats [widget.get_active()]
         return
 
 
-    def run (self):
-        ret = self._w_openurl.run ()
+    def run(self):
+        ret = self._w_openurl.run()
 
         if ret != Gtk.ResponseType.OK:
-            self._w_openurl.destroy ()
+            self._w_openurl.destroy()
             return (None, None)
 
-        url = self._w_url.get_text ()
+        url = self._w_url.get_text()
 
-        self._w_openurl.destroy ()
+        self._w_openurl.destroy()
 
         return (url, self.ftype)
diff --git a/Pyblio/GnomeUI/glade/openurl.ui b/Pyblio/GnomeUI/glade/openurl.ui
new file mode 100644
index 0000000..bac9e6c
--- /dev/null
+++ b/Pyblio/GnomeUI/glade/openurl.ui
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="_w_openurl">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Open Location</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton1">
+                <property name="label">gtk-cancel</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton1">
+                <property name="label">gtk-ok</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+                <accelerator key="Return" signal="clicked"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Enter the location (URI) of the file you would 
like to open:</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">5</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="_w_url">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">5</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Bibliography type:</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="padding">3</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="_w_combobox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="padding">3</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton1</action-widget>
+      <action-widget response="-5">okbutton1</action-widget>
+    </action-widgets>
+  </object>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]