[Fedora-config-list] Python class to make PyGTK code simpler

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

 



Hi,

Seth Vidal invited me to join this list because of
some code I submitted to RedHat's bugzilla:

<https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=91423>

Here's a short excerpt:

"I was using Red Hat's code (specifically 
redhat-config-services) to learn how to
use Glade, libglade, and Python to code GNOME GUI's. 
Although I was unfamiliar with libglade, I consider
myself to be a Python expert.  I wrote a simple class
that can make some of the code in
python-config-services unnecessary.  I thought
I might share this code with you in the hopes that it
might be useful."

Code such as:

        self.xml.signal_autoconnect(
            { "on_mainwin_delete_event" : self.quit,
              "on_mainwin_hide" : self.quit,
              "on_mnuRescan_activate" :
self.on_mnuRescan_activate,
              "on_mnuSave_activate" :
self.on_mnuSave_clicked,
              "on_mnuRevert_activate" :
self.on_mnuRevert_clicked,
              "on_mnuExit_activate" : self.quit,
              "on_mnuStart_activate" :
self.on_btnStart_clicked,
              "on_mnuStop_activate" :
self.on_btnStop_clicked,
              "on_mnuRestart_activate" :
self.on_btnRestart_clicked,
              "on_pmnStart_activate" :
self.on_btnStart_clicked,
              "on_pmnStop_activate" :
self.on_btnStop_clicked,
              "on_pmnRestart_activate" :
self.on_btnRestart_clicked,
              "on_btnStart_clicked" :
self.on_btnStart_clicked,
              "on_btnRestart_clicked" :
self.on_btnRestart_clicked,
              "on_btnStop_clicked" :
self.on_btnStop_clicked,
              "on_mnuAbout_activate" :
self.on_mnuAbout_activate,
              "on_mnuManual_activate" :
self.on_mnuManual_activate,
              "on_optRL3_activate" :
self.on_optRL3_activate,
              "on_optRL4_activate" :
self.on_optRL4_activate,
              "on_optRL5_activate" :
self.on_optRL5_activate ,
              "on_pmnStart_activate" :
self.on_btnStart_clicked,
              "on_pmnStop_activate" :
self.on_btnStop_clicked,
              "on_pmnRestart_activate" :
self.on_btnRestart_clicked } )

and

        self.mnuRescan =
self.xml.get_widget("mnuRescan")
        self.mnuSave = self.xml.get_widget("mnuSave")
        self.mnuRevert =
self.xml.get_widget("mnuRevert")
        self.mnuExit = self.xml.get_widget("mnuExit")
        self.mnuAbout =
self.xml.get_widget("mnuAbout")
        self.mnuStart =
self.xml.get_widget("mnuStart")
        self.mnuStop = self.xml.get_widget("mnuStop")
        self.mnuRestart =
self.xml.get_widget("mnuRestart")
        self.optRL3 = self.xml.get_widget("optRL3")
        self.optRL4 = self.xml.get_widget("optRL4")
        self.optRL5 = self.xml.get_widget("optRL5")

can completely be handled by my short super-class.

After submitting that to bugzilla, I later went on to
use those baseclasses in an open source project named
GCipher:

<http://gcipher.sourceforge.net/>

Things worked out pretty well.  Later, I read an
article in Dr. Dobb's Journal describing techniques
almost exactly like mine.  Either a) it's a good idea
that several people have had or b) it's functionality
that should possibly be put into PyGTK itself c) I
haven't read enough about PyGTK to make PyGTK do this
stuff automatically.

Well, in summary, if you would like to take a look at
my base classes in a very small application, check
out:

<http://ironorchid.com/jjinux/articles/pytemp-0.2.tar.gz>

If this is something you guys have already discussed
and worked out, pardon me, because I just joined the
list.

Best Regards,
-jj

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree




[Index of Archives]     [Fedora Users]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Big List of Linux Books]     [Gimp]     [Yosemite News]