[pygtk] Passing self.wTree to other classes? Good Idea?
Riley Porter
rileyporter at gmail.com
Fri Jan 23 12:40:13 WST 2009
Hello All,
I recently began using PyGTK + glade to begin work on a project that will
require multiple developers to contribute code to their "sections". What I
mean by this is say the app has a window and it has 1 notebook with 5 tabs
in it. Each developer would be in charge of maintaining his / her tab.
That being said each of the tab's widgets would eventually start to work
together. meaning tab1 might find available hosts on a lan.. tab2 might get
the hosts discovered in tab1 and ping them.. or whatever..
I currently am basically passing having one main file that initializes other
classes in other files and passes self.wTree to each of the following files
so that they all can interact with widgets on different tabs (that are being
used in different source files)
I know I am not making this very clear but here is an example of what I am
doing.
main.py
try:
import pygtk
pygtk.require("2.0")
except:
pass
try:
import gtk
import gtk.glade
except:
print "Failed to load needed gtk libs"
sys.exit(1)
class Log_Viewer:
def __init__(self):
classes = ["manual","parser"]
self.gladefile = "logview.glade"
self.wTree = gtk.glade.XML(self.gladefile)
self.window = self.wTree.get_widget("MainWindow")
"""
Set Status Bar
"""
statusbar = self.wTree.get_widget("STATUSBAR_Main")
STATUSBAR_TXT = statusbar.push(1,'www.Synthetos.com')
self.wTree.signal_autoconnect(self) #Connect all signals to their
corresponding functions with the self object
#Initialize All Classes
Manual.Manual(self.wTree)
--
Riley Porter
Network Security Engineer
Offensive Security - OSCP
SANS GIAC - GCIH
CCNA, Security+
ACSA - Arcsight Security Analyst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090122/6f1f5da4/attachment.htm
More information about the pygtk
mailing list