[conduit] Finished porting SmugMug to new config system.



commit 18a138e2f1a092cf5baa8c816719297e46d76fba
Author: Alexandre Rosenfeld <airmind gmail com>
Date:   Fri May 1 22:48:41 2009 -0300

    Finished porting SmugMug to new config system.
---
 conduit/modules/SmugMugModule/Makefile.am      |    3 -
 conduit/modules/SmugMugModule/SmugMugModule.py |   57 +-------
 conduit/modules/SmugMugModule/config.glade     |  170 ------------------------
 3 files changed, 8 insertions(+), 222 deletions(-)

diff --git a/conduit/modules/SmugMugModule/Makefile.am b/conduit/modules/SmugMugModule/Makefile.am
index f8c7d1d..f7860f3 100644
--- a/conduit/modules/SmugMugModule/Makefile.am
+++ b/conduit/modules/SmugMugModule/Makefile.am
@@ -3,8 +3,5 @@ SUBDIRS = SmugMugAPI
 conduit_handlersdir = $(libdir)/conduit/modules/SmugMugModule
 conduit_handlers_PYTHON = SmugMugModule.py
 
-conduit_handlers_DATA = config.glade
-EXTRA_DIST = config.glade
-
 clean-local:
 	rm -rf *.pyc *.pyo
diff --git a/conduit/modules/SmugMugModule/SmugMugModule.py b/conduit/modules/SmugMugModule/SmugMugModule.py
index 1b2854c..61b9c39 100644
--- a/conduit/modules/SmugMugModule/SmugMugModule.py
+++ b/conduit/modules/SmugMugModule/SmugMugModule.py
@@ -33,10 +33,12 @@ class SmugMugTwoWay(Image.ImageTwoWay):
 
     def __init__(self, *args):
         Image.ImageTwoWay.__init__(self)
-        self.username = ""
-        self.password = ""
-        self.album = ""
-        self.imageSize = "None"
+        self.update_configuration(
+            username = "",
+            password = "",
+            album = "",
+            imageSize = "None",
+        )
         self.sapi = None
 
     def _get_photo_info (self, photoId):
@@ -102,8 +104,8 @@ class SmugMugTwoWay(Image.ImageTwoWay):
         return self.imageSize
  
     def config_setup(self, config):
-        config.add_section("Account")
-        config.add_item("Email", "text",
+        config.add_section("Account details")
+        config.add_item("Username", "text",
             config_name = "username"
         )
         config.add_item("Password", "text",
@@ -118,50 +120,7 @@ class SmugMugTwoWay(Image.ImageTwoWay):
             choices = [("None", "No resize"), ("640x480", "640x480"), ("800x600", "800x600"), ("1024x768", "1024x768")],
             config_name = "imageSize"
         )
- 
-    def configure_(self, window):
-        """
-        Configures the SmugMugTwoWay
-        """
-        widget = Utils.dataprovider_glade_get_widget(
-                        __file__, 
-                        "config.glade", 
-                        "SmugMugTwoWayConfigDialog")
-                        
-        #get a whole bunch of widgets
-        username = widget.get_widget("username")
-        password = widget.get_widget("password")
-        album = widget.get_widget("album")                
-        
-        #preload the widgets        
-        username.set_text(self.username)
-        password.set_text(self.password)
-        album.set_text (self.album)
-
-        resizecombobox = widget.get_widget("combobox1")
-        self._resize_combobox_build(resizecombobox, self.imageSize)
-        
-        dlg = widget.get_widget("SmugMugTwoWayConfigDialog")
-
-        dlg.set_transient_for(window)
         
-        response = Utils.run_dialog (dlg, window)
-
-        if response == True:
-            self.username = username.get_text()
-            self.password = password.get_text()
-            self.album = album.get_text()
-            self.imageSize = self._resize_combobox_get_active(resizecombobox)
-        dlg.destroy()    
-        
-    def get_configuration(self):
-        return {
-            "imageSize" : self.imageSize,
-            "username" : self.username,
-            "password" : self.password,
-            "album" : self.album
-            }
-            
     def is_configured (self, isSource, isTwoWay):
         if len(self.username) < 1:
             return False
diff --git a/conduit/modules/SmugMugModule/config.glade b/conduit/modules/SmugMugModule/config.glade
deleted file mode 100644
index 3adc479..0000000
--- a/conduit/modules/SmugMugModule/config.glade
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--*- mode: xml -*-->
-<glade-interface>
-  <widget class="GtkDialog" id="SmugMugTwoWayConfigDialog">
-    <property name="visible">True</property>
-    <property name="title" translatable="yes">SmugMug</property>
-    <property name="resizable">False</property>
-    <property name="default_width">250</property>
-    <property name="default_height">350</property>
-    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-    <child internal-child="vbox">
-      <widget class="GtkVBox" id="vbox30">
-        <property name="visible">True</property>
-        <property name="spacing">5</property>
-        <child>
-          <widget class="GtkLabel" id="label74">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">&lt;b&gt;Account Details&lt;/b&gt;</property>
-            <property name="use_markup">True</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkLabel" id="label77">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Username:</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">3</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkEntry" id="username">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">4</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkLabel" id="label78">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Password:</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">5</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkEntry" id="password">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-		<property name="visibility">False</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">6</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkLabel" id="label80">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">&lt;b&gt;Saved Photo Settings&lt;/b&gt;</property>
-            <property name="use_markup">True</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">7</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkLabel" id="label79">
-            <property name="visible">True</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Album:</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">8</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkEntry" id="album">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">9</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkLabel" id="label1">
-            <property name="visible">True</property>
-            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-            <property name="xalign">0</property>
-            <property name="label" translatable="yes">Resize Photos:</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">10</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkComboBox" id="combobox1">
-            <property name="visible">True</property>
-            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">11</property>
-          </packing>
-        </child>
-        <child internal-child="action_area">
-          <widget class="GtkHButtonBox" id="hbuttonbox12">
-            <property name="visible">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <widget class="GtkButton" id="button32">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-cancel</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-6</property>
-              </widget>
-            </child>
-            <child>
-              <widget class="GtkButton" id="button33">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-ok</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">-5</property>
-              </widget>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">GTK_PACK_END</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
-</glade-interface>



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