rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
gtk.mainquit()
|
gtk.main_quit()
|
def doExit (self, dialog, response): dialog.destroy() if response == gtk.RESPONSE_YES: gtk.mainquit()
|
7a12691d5e7922078fe08702270a07c5e3f483ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/7a12691d5e7922078fe08702270a07c5e3f483ee/driconf.py
|
self.digits = 1
|
self.digits = 0
|
def __init__ (self, callback, lower, upper, integer): gtk.VBox.__init__ (self) diff = upper - lower self.isInteger = integer if integer: step = 1 page = (diff+4) / 5 self.digits = 1 else: self.digits = -int(math.floor(math.log10(diff) + 0.5)) + 3 step = math.pow(10, -self.digits + 1) page = step * 10 if self.digits < 0: self.digits = 0 self.callback = callback self.adjustment = gtk.Adjustment (lower, lower, upper, step, page) self.spinner = gtk.SpinButton (self.adjustment, step, self.digits) self.spinner.set_numeric (TRUE) self.spinner.show() self.pack_start (self.spinner, FALSE, FALSE, 0) if not integer or diff >= 20: self.slider = gtk.HScale (self.adjustment) self.slider.set_size_request (200, -1) self.slider.set_draw_value (FALSE) self.slider.show() self.pack_start (self.slider, FALSE, FALSE, 0) self.adjConn = self.adjustment.connect ("value-changed", callback)
|
d189593b27596492c1a1e5cd0bf35d77a4719009 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/d189593b27596492c1a1e5cd0bf35d77a4719009/driconf.py
|
class MessageDialog (gtk.Dialog): """ A simple message dialog with configurable buttons and a callback. """ def __init__ (self, title, message, buttons = ["OK"], callback = None, modal = TRUE): """ Constructor. """ gtk.Dialog.__init__ (self) if mainWindow: self.set_transient_for (mainWindow) self.callback = callback self.set_title (title) first = None for name in buttons: button = gtk.Button (name) button.set_flags (gtk.CAN_DEFAULT) button.connect ("clicked", self.clickedSignal, name) button.show() self.action_area.pack_start (button, TRUE, FALSE, 10) if not first: first = button hbox = gtk.HBox() label = gtk.Label (message) label.set_justify (gtk.JUSTIFY_LEFT) label.set_line_wrap (TRUE) label.show() hbox.pack_start (label, TRUE, TRUE, 20) hbox.show() self.vbox.pack_start (hbox, TRUE, TRUE, 10) first.grab_default() self.set_modal (modal) self.show() def clickedSignal (self, widget, name): """ Handler for clicked signals. """ if self.callback: self.callback (name) self.destroy()
|
def __init__ (self, data): """ Constructor. """ gtk.Image.__init__ (self) pixmap, mask = gtk.gdk.pixmap_colormap_create_from_xpm_d(None, self.window.get_colormap(), None, data) self.set_from_pixmap (pixmap, mask)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
|
MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE)
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.") dialog.connect ("response", lambda d,r: d.destroy()) dialog.show()
|
def __init__ (self, driver, app): """ Constructor. """ gtk.Frame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = gtk.Entry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, gtk.EXPAND|gtk.FILL, 0, 5, 5) notebook = gtk.Notebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = gtk.Label (desc) else: sectLabel = gtk.Label ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = gtk.Label ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, gtk.FILL, gtk.EXPAND|gtk.FILL, 5, 5) table.show() self.add (table)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
ok.set_flags (CAN_DEFAULT)
|
ok.set_flags (gtk.CAN_DEFAULT)
|
def __init__ (self, title, callback): gtk.Dialog.__init__ (self) self.set_transient_for (mainWindow) self.set_title (title) self.callback = callback ok = gtk.Button ("OK") ok.set_flags (CAN_DEFAULT) ok.connect ("clicked", self.okSignal) ok.show() self.action_area.pack_start (ok, TRUE, FALSE, 10) cancel = gtk.Button ("Cancel") cancel.set_flags (CAN_DEFAULT) cancel.connect ("clicked", self.cancelSignal) cancel.show() self.action_area.pack_start (cancel, TRUE, FALSE, 10) ok.grab_default() self.set_modal (TRUE)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
cancel.set_flags (CAN_DEFAULT)
|
cancel.set_flags (gtk.CAN_DEFAULT)
|
def __init__ (self, title, callback): gtk.Dialog.__init__ (self) self.set_transient_for (mainWindow) self.set_title (title) self.callback = callback ok = gtk.Button ("OK") ok.set_flags (CAN_DEFAULT) ok.connect ("clicked", self.okSignal) ok.show() self.action_area.pack_start (ok, TRUE, FALSE, 10) cancel = gtk.Button ("Cancel") cancel.set_flags (CAN_DEFAULT) cancel.connect ("clicked", self.cancelSignal) cancel.show() self.action_area.pack_start (cancel, TRUE, FALSE, 10) ok.grab_default() self.set_modal (TRUE)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Error", "Parsing the driver's configuration information: " + str(problem), modal=FALSE)
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "Parsing the driver's configuration information: %s" % problem) dialog.connect ("response", lambda d,r: d.destroy()) dialog.show()
|
def selectRowSignal (self, widget, row, column, event, data): type, obj = self.get_row_data (row) if type == "app": app = obj try: driver = app.device.getDriver (dpy) except dri.XMLError, problem: driver = None MessageDialog ("Error", "Parsing the driver's configuration information: " + str(problem), modal=FALSE) else: if driver == None: MessageDialog ("Notice", "Can't determine the driver for this device.", modal=FALSE) else: driver = None app = None mainWindow.commitDriverPanel() mainWindow.switchDriverPanel (driver, app) if type == "config": mainWindow.activateConfigButtons(obj) elif type == "device": mainWindow.activateDeviceButtons(obj) elif type == "app": mainWindow.activateAppButtons(obj)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Notice", "Can't determine the driver for this device.", modal=FALSE)
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK, "Can't determine the driver for this device.") dialog.connect ("response", lambda d,r: d.destroy()) dialog.show()
|
def selectRowSignal (self, widget, row, column, event, data): type, obj = self.get_row_data (row) if type == "app": app = obj try: driver = app.device.getDriver (dpy) except dri.XMLError, problem: driver = None MessageDialog ("Error", "Parsing the driver's configuration information: " + str(problem), modal=FALSE) else: if driver == None: MessageDialog ("Notice", "Can't determine the driver for this device.", modal=FALSE) else: driver = None app = None mainWindow.commitDriverPanel() mainWindow.switchDriverPanel (driver, app) if type == "config": mainWindow.activateConfigButtons(obj) elif type == "device": mainWindow.activateDeviceButtons(obj) elif type == "app": mainWindow.activateAppButtons(obj)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Question", "Really delete application \"" + obj.name + "\"?", ["Yes", "No"], self.doRemoveItem)
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Really delete application \"%s\"?" % obj.name)
|
def removeItem (self, widget): try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node) if type == "app": MessageDialog ("Question", "Really delete application \"" + obj.name + "\"?", ["Yes", "No"], self.doRemoveItem) elif type == "device": MessageDialog ("Question", "Really delete device and all applications in it?", ["Yes", "No"], self.doRemoveItem) else: MessageDialog ("Notice", "Select a device or application.")
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Question", "Really delete device and all applications in it?", ["Yes", "No"], self.doRemoveItem) else: MessageDialog ("Notice", "Select a device or application.") def doRemoveItem (self, buttonName): if buttonName != "Yes": return try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node)
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Really delete device and all applications in it?") else: raise Exception ("This should never happen.") response = dialog.run() dialog.destroy () if response != gtk.RESPONSE_YES: return
|
def removeItem (self, widget): try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node) if type == "app": MessageDialog ("Question", "Really delete application \"" + obj.name + "\"?", ["Yes", "No"], self.doRemoveItem) elif type == "device": MessageDialog ("Question", "Really delete device and all applications in it?", ["Yes", "No"], self.doRemoveItem) else: MessageDialog ("Notice", "Select a device or application.")
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
else: return
|
def doRemoveItem (self, buttonName): if buttonName != "Yes": return try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node) if type == "app": parent = obj.device config = parent.config siblings = parent.apps elif type == "device": parent = obj.config config = parent siblings = parent.devices else: return siblings.remove (obj) if type == "app": mainWindow.removeApp (obj) elif type == "device": for app in obj.apps: mainWindow.removeApp (app) self.remove_node (node) config.modifiedCallback()
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
|
self.doSaveConfig() def doSaveConfig (self, reallySave="dunno"): if reallySave == "No": return
|
def saveConfig (self, widget): self.doSaveConfig()
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
|
if reallySave == "dunno": valid = 1 for device in config.devices: try: driver = device.getDriver (dpy) except dri.XMLError: driver = None if driver == None: continue for app in device.apps: valid = valid and driver.validate (app.options) if not valid: MessageDialog ("Question", "The configuration contains invalid entries. Save anyway?", ["Yes", "No"], self.doSaveConfig)
|
valid = 1 for device in config.devices: try: driver = device.getDriver (dpy) except dri.XMLError: driver = None if driver == None: continue for app in device.apps: valid = valid and driver.validate (app.options) if not valid: dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "The configuration contains invalid entries. Save anyway?") response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_YES:
|
def doSaveConfig (self, reallySave="dunno"): if reallySave == "No": return try: node = self.getSelection() except SelectionError: return type, config = self.node_get_row_data (node) if type == "app": config = config.device type = "device" if type == "device": config = config.config type = "config" if reallySave == "dunno": valid = 1 for device in config.devices: try: driver = device.getDriver (dpy) except dri.XMLError: driver = None if driver == None: continue for app in device.apps: valid = valid and driver.validate (app.options) if not valid: MessageDialog ("Question", "The configuration contains invalid entries. Save anyway?", ["Yes", "No"], self.doSaveConfig) return try: file = open (config.fileName, "w") except IOError: MessageDialog ("Error", "Can't open \""+config.fileName+"\" for writing.") return mainWindow.commitDriverPanel() file.write (str(config)) file.close() config.modifiedCallback(FALSE)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Error", "Can't open \""+config.fileName+"\" for writing.")
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "Can't open \"%s\" for writing." % config.fileName) dialog.run() dialog.destroy()
|
def doSaveConfig (self, reallySave="dunno"): if reallySave == "No": return try: node = self.getSelection() except SelectionError: return type, config = self.node_get_row_data (node) if type == "app": config = config.device type = "device" if type == "device": config = config.config type = "config" if reallySave == "dunno": valid = 1 for device in config.devices: try: driver = device.getDriver (dpy) except dri.XMLError: driver = None if driver == None: continue for app in device.apps: valid = valid and driver.validate (app.options) if not valid: MessageDialog ("Question", "The configuration contains invalid entries. Save anyway?", ["Yes", "No"], self.doSaveConfig) return try: file = open (config.fileName, "w") except IOError: MessageDialog ("Error", "Can't open \""+config.fileName+"\" for writing.") return mainWindow.commitDriverPanel() file.write (str(config)) file.close() config.modifiedCallback(FALSE)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
self.doReloadConfig () def doReloadConfig (self, reallyReload="dunno"): if reallyReload == "No": return
|
def reloadConfig (self, widget): self.doReloadConfig ()
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
|
if reallyReload == "dunno": MessageDialog ("Question", "Really reload " + config.fileName + " from disk?", ["Yes", "No"], self.doReloadConfig)
|
else: config = obj dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Really reload \"%s\" from disk?" % config.fileName) response = dialog.run() dialog.destroy() if response != gtk.RESPONSE_YES:
|
def doReloadConfig (self, reallyReload="dunno"): if reallyReload == "No": return try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node) if type == "app": config = obj.device.config elif type == "device": config = obj.config if reallyReload == "dunno": MessageDialog ("Question", "Really reload " + config.fileName + " from disk?", ["Yes", "No"], self.doReloadConfig) return try: cfile = open (config.fileName, "r") except IOError: MessageDialog ("Notice", "Couldn't open " + config.fileName + " for reading. The file was not reloaded.") return # Try to parse the configuration file. try: newConfig = dri.DRIConfig (cfile) except dri.XMLError, problem: MessageDialog ("Error", "Configuration file \""+config.fileName+ "\" contains errors:\n"+str(problem)+ "\nThe file was not reloaded.") close (cfile) return # Check if the file is writable in the end. newConfig.writable = fileIsWritable (config.fileName) # find the position of config index = self.configList.index (config) if index == len(self.configList)-1: sibling = None else: sibling = self.configList[index+1] self.configList.remove (config) if type == "app": mainWindow.removeApp (obj) elif type == "device": for app in obj.apps: mainWindow.removeApp (app) self.remove_node (config.node) self.addConfig (newConfig, sibling)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Notice", "Couldn't open " + config.fileName + " for reading. The file was not reloaded.")
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "Couldn't open \"%s\" for reading. The file was not reloaded."% config.fileName) dialog.run() dialog.destroy()
|
def doReloadConfig (self, reallyReload="dunno"): if reallyReload == "No": return try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node) if type == "app": config = obj.device.config elif type == "device": config = obj.config if reallyReload == "dunno": MessageDialog ("Question", "Really reload " + config.fileName + " from disk?", ["Yes", "No"], self.doReloadConfig) return try: cfile = open (config.fileName, "r") except IOError: MessageDialog ("Notice", "Couldn't open " + config.fileName + " for reading. The file was not reloaded.") return # Try to parse the configuration file. try: newConfig = dri.DRIConfig (cfile) except dri.XMLError, problem: MessageDialog ("Error", "Configuration file \""+config.fileName+ "\" contains errors:\n"+str(problem)+ "\nThe file was not reloaded.") close (cfile) return # Check if the file is writable in the end. newConfig.writable = fileIsWritable (config.fileName) # find the position of config index = self.configList.index (config) if index == len(self.configList)-1: sibling = None else: sibling = self.configList[index+1] self.configList.remove (config) if type == "app": mainWindow.removeApp (obj) elif type == "device": for app in obj.apps: mainWindow.removeApp (app) self.remove_node (config.node) self.addConfig (newConfig, sibling)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Error", "Configuration file \""+config.fileName+ "\" contains errors:\n"+str(problem)+ "\nThe file was not reloaded.") close (cfile) return
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "Configuration file \"%s\" contains errors:\n%s\nThe file was not reloaded." % (config.fileName, str(problem))) dialog.run() dialog.destroy() os.close (cfile) return os.close (cfile)
|
def doReloadConfig (self, reallyReload="dunno"): if reallyReload == "No": return try: node = self.getSelection() except SelectionError: return type, obj = self.node_get_row_data (node) if type == "app": config = obj.device.config elif type == "device": config = obj.config if reallyReload == "dunno": MessageDialog ("Question", "Really reload " + config.fileName + " from disk?", ["Yes", "No"], self.doReloadConfig) return try: cfile = open (config.fileName, "r") except IOError: MessageDialog ("Notice", "Couldn't open " + config.fileName + " for reading. The file was not reloaded.") return # Try to parse the configuration file. try: newConfig = dri.DRIConfig (cfile) except dri.XMLError, problem: MessageDialog ("Error", "Configuration file \""+config.fileName+ "\" contains errors:\n"+str(problem)+ "\nThe file was not reloaded.") close (cfile) return # Check if the file is writable in the end. newConfig.writable = fileIsWritable (config.fileName) # find the position of config index = self.configList.index (config) if index == len(self.configList)-1: sibling = None else: sibling = self.configList[index+1] self.configList.remove (config) if type == "app": mainWindow.removeApp (obj) elif type == "device": for app in obj.apps: mainWindow.removeApp (app) self.remove_node (config.node) self.addConfig (newConfig, sibling)
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
MessageDialog ("Question", "There are unsaved modifications. Exit anyway?", ["Yes", "No"], self.doExit)
|
dialog = gtk.MessageDialog ( mainWindow, gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_MODAL, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "There are unsaved modifications. Exit anyway?") dialog.connect ("response", self.doExit) dialog.show()
|
def exitHandler (self, widget, event=None): modified = FALSE for config in self.configTree.getConfigList(): if config.modified: modified = TRUE break if modified: MessageDialog ("Question", "There are unsaved modifications. Exit anyway?", ["Yes", "No"], self.doExit) return TRUE elif event == None: gtk.mainquit() else: return FALSE
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
def doExit (self, choice): if choice == "Yes":
|
def doExit (self, dialog, response): dialog.destroy() if response == gtk.RESPONSE_YES:
|
def doExit (self, choice): if choice == "Yes": gtk.mainquit()
|
44ba4a387d4167dedba8d083a763a0b3d1a1236b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/44ba4a387d4167dedba8d083a763a0b3d1a1236b/driconf.py
|
self.widget.modify_text (gtk.STATE_NORMAL, self.widget.\ get_colormap().alloc(65535, 0, 0))
|
self.widget.modify_text (gtk.STATE_NORMAL, gtk.gdk.Color (65535, 0, 0)) self.widget.modify_text (gtk.STATE_SELECTED, gtk.gdk.Color (65535, 0, 0)) self.widget.modify_text (gtk.STATE_INSENSITIVE, gtk.gdk.Color (65535, 0, 0))
|
def validate (self): """ Validate the current value from the option widget.
|
75886ca115f372e600195c36a3b80ee9286d82e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/75886ca115f372e600195c36a3b80ee9286d82e3/driconf.py
|
gtk.STATE_NORMAL, self.sectLabels[index].get_colormap().alloc(65535, 0, 0))
|
gtk.STATE_NORMAL, gtk.gdk.Color (65535, 0, 0)) self.sectLabels[index].modify_fg ( gtk.STATE_ACTIVE, gtk.gdk.Color (65535, 0, 0))
|
def validate (self): """ Validate the configuration.
|
75886ca115f372e600195c36a3b80ee9286d82e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/75886ca115f372e600195c36a3b80ee9286d82e3/driconf.py
|
style.fg[gtk.STATE_NORMAL] = self.get_colormap().alloc(65535, 0, 0)
|
style.fg[gtk.STATE_NORMAL] = gtk.gdk.Color (65535, 0, 0)
|
def validateAppNode (self, app): try: driver = app.device.getDriver(dpy) except dri.XMLError: driver = None if driver: if driver.validate (app.options): style = self.get_style().copy() style.fg[gtk.STATE_NORMAL] = self.defaultFg self.node_set_row_style(app.node, style) else: style = self.get_style().copy() style.fg[gtk.STATE_NORMAL] = self.get_colormap().alloc(65535, 0, 0) self.node_set_row_style(app.node, style)
|
75886ca115f372e600195c36a3b80ee9286d82e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/75886ca115f372e600195c36a3b80ee9286d82e3/driconf.py
|
if type == "int":
|
if type == "int" or type == "enum":
|
def StrToValue (str, type): """ Helper: convert str to given type. Raises an XMLError if str is not of the correct type. """ try: if type == "int": return int (str); elif type == "float": return float (str); else: if str == "true": return 1 elif str == "false": return 0 else: raise ValueError except ValueError: raise XMLError ("invalid value '" + str + "' for type '" + type + "'")
|
c09909653a40991dcb8ea5ae43ac0e32c59f2cf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/c09909653a40991dcb8ea5ae43ac0e32c59f2cf9/dri.py
|
if type == "int" or type == "float":
|
if type == "int" or type == "enum" or type == "float":
|
def ValueToStr (value, type): """ Helper: convert value of given type to string. """ if type == "int" or type == "float": return str(value) elif value: return "true" else: return "false"
|
c09909653a40991dcb8ea5ae43ac0e32c59f2cf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/c09909653a40991dcb8ea5ae43ac0e32c59f2cf9/dri.py
|
assert type == "int" or type == "float"
|
assert type == "int" or type == "enum" or type == "float"
|
def __init__ (self, str, type): """ Parse str as a range.
|
c09909653a40991dcb8ea5ae43ac0e32c59f2cf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/c09909653a40991dcb8ea5ae43ac0e32c59f2cf9/dri.py
|
if type != "int" and type != "float" and type != "bool":
|
if type != "int" and type != "enum" and type != "float" \ and type != "bool":
|
def __init__ (self, name, type, default, valid = None): """ Initialize option information.
|
c09909653a40991dcb8ea5ae43ac0e32c59f2cf9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/c09909653a40991dcb8ea5ae43ac0e32c59f2cf9/dri.py
|
print "%s(%d): %s" % (name, row, newVal)
|
def editedSignal (self, widget, row, newVal, value): row = int(row) name = self.opts[row] print "%s(%d): %s" % (name, row, newVal) iter = self.store.get_iter_first() for i in range(row): iter = self.store.iter_next (iter) if value: if self.app.options[name] == newVal: return self.app.options[name] = newVal self.store.set (iter, 0, str(name), 1, str(newVal), 2, TRUE) else: if name == newVal or self.app.options.has_key(newVal) or \ self.driverOpts.has_key(newVal): return val = self.app.options.pop(name) name = newVal self.opts[row] = name self.app.options[name] = val self.store.set (iter, 0, str(name), 1, str(val), 2, TRUE) self.app.modified(self.app)
|
77516450478a8f4985bb03f27ed6dfc78d2c8c4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/77516450478a8f4985bb03f27ed6dfc78d2c8c4b/driconf.py
|
|
for v in range (r.start, r.end+1): vString = dri.ValueToStr(v, type) if type == "enum" and desc and desc.enums.has_key(v): string = desc.enums[v] else: string = vString optValList.append ((string, vString))
|
if type == "enum": for v in range (r.start, r.end+1): vString = dri.ValueToStr(v, type) if type == "enum" and desc and desc.enums.has_key(v): string = desc.enums[v] else: string = vString optValList.append ((string, vString)) else: vString = dri.ValueToStr(r.start, type) optValList.append ((vString, vString))
|
def initWidget (self, opt, value): """ Initialize the option widget.
|
4257fec38bb025817f1cce659594aab8b4dfa10f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/4257fec38bb025817f1cce659594aab8b4dfa10f/driconf.py
|
return str(node.name)
|
try: driver = node.device.getDriver(dpy) except dri.XMLError: driver = None if driver and not driver.validate (node.options): return '<span foreground="red">' + str(node.name) + '</span>' else: return str(node.name)
|
def on_get_value (self, node, col): if node.__class__ == dri.DRIConfig: return str(node.fileName) elif node.__class__ == dri.DeviceConfig: if node.screen and node.driver: name = "Screen %s Driver %s" % (node.screen, node.driver) elif node.screen: name = "Screen %s" % node.screen elif node.driver: name = "Driver %s" % node.driver else: name = "general" return str(name) elif node.__class__ == dri.AppConfig: return str(node.name) else: return "What's this?"
|
5679b097fffb4b6fb7fd7bf13c850e60d8d6bf50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/5679b097fffb4b6fb7fd7bf13c850e60d8d6bf50/driconf.py
|
text=0)
|
markup=0)
|
def __init__ (self, configList): self.model = ConfigTreeModel (configList) gtk.TreeView.__init__ (self, self.model) self.set_size_request (200, -1) self.set_headers_visible (FALSE) self.expand_all() self.get_selection().set_mode (gtk.SELECTION_BROWSE) self.get_selection().connect ("changed", self.selectionChangedSignal) column = gtk.TreeViewColumn ("ConfigTree", gtk.CellRendererText(), text=0) self.append_column (column)
|
5679b097fffb4b6fb7fd7bf13c850e60d8d6bf50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/5679b097fffb4b6fb7fd7bf13c850e60d8d6bf50/driconf.py
|
try: driver = app.device.getDriver(dpy) except dri.XMLError: driver = None if driver and driver.validate (app.options): pass else: pass
|
path = self.model.getPathFromNode (app) iter = self.model.get_iter (path) self.model.row_changed (path, iter)
|
def validateAppNode (self, app): try: driver = app.device.getDriver(dpy) except dri.XMLError: driver = None if driver and driver.validate (app.options): #style = self.get_style().copy() #style.fg[gtk.STATE_NORMAL] = self.defaultFg #self.node_set_row_style(app.node, style) pass else: #style = self.get_style().copy() #style.fg[gtk.STATE_NORMAL] = gtk.gdk.Color (65535, 0, 0) #self.node_set_row_style(app.node, style) pass
|
5679b097fffb4b6fb7fd7bf13c850e60d8d6bf50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/5679b097fffb4b6fb7fd7bf13c850e60d8d6bf50/driconf.py
|
column.add_attribute (renderText, "text", 1)
|
column.add_attribute (renderText, "markup", 1)
|
def __init__ (self, configList): self.model = ConfigTreeModel (configList) gtk.TreeView.__init__ (self, self.model) self.model.renderIcons (self) self.set_size_request (200, -1) self.set_headers_visible (FALSE) self.expand_all() self.get_selection().set_mode (gtk.SELECTION_BROWSE) self.get_selection().connect ("changed", self.selectionChangedSignal) column = gtk.TreeViewColumn() renderPixbuf = gtk.CellRendererPixbuf() column.pack_start (renderPixbuf, expand=False) column.add_attribute (renderPixbuf, "pixbuf", 0) renderText = gtk.CellRendererText() column.pack_start (renderText, expand=True) column.add_attribute (renderText, "text", 1) self.append_column (column)
|
0fc9c790439eb9f684f077d3c0193354f8d04670 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/0fc9c790439eb9f684f077d3c0193354f8d04670/driconf.py
|
"Parsing the driver's configuration information: " + problem,
|
"Parsing the driver's configuration information: " + str(problem),
|
def selectRowSignal (self, widget, row, column, event, data): type, obj = self.get_row_data (row) if type == "app": app = obj try: driver = app.device.getDriver (dpy) except dri.XMLError, problem: driver = None MessageDialog ("Error", "Parsing the driver's configuration information: " + problem, modal=FALSE) else: if driver == None: MessageDialog ("Notice", "Can't determine the driver for this device.", modal=FALSE) else: driver = None app = None self.mainWindow.commitDriverPanel() self.mainWindow.switchDriverPanel (driver, app) if type == "config": self.mainWindow.activateConfigButtons(obj.writable) elif type == "device": self.mainWindow.activateDeviceButtons(obj.config.writable) elif type == "app": self.mainWindow.activateAppButtons(obj.device.config.writable)
|
f5656778fe89e185d25c4820da54837a359ca399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/f5656778fe89e185d25c4820da54837a359ca399/driconf.py
|
self.highlightInvalid() self.widget.show()
|
def initWidget (self, opt, value): """ Initialize the option widget.
|
dc59153c95872b6bb4883a3fb4f5f378475c405f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/dc59153c95872b6bb4883a3fb4f5f378475c405f/driconf.py
|
|
hBox.pack_start(infoImage, False, False, 0)
|
infoImageVBox.pack_start(infoImage, False, False, 0) infoImageVBox.show() hBox.pack_start(infoImageVBox, False, False, 0)
|
def __init__ (self, title, parent, app=None): gtk.Dialog.__init__(self, title, parent, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, ("gtk-ok", gtk.RESPONSE_OK, "gtk-cancel", gtk.RESPONSE_CANCEL)) table = gtk.Table(3, 2) nameLabel = gtk.Label(_("Application Name")) nameLabel.show() table.attach(nameLabel, 0, 1, 0, 1, 0, gtk.EXPAND, 10, 5) self.nameEntry = gtk.Entry() if app: self.nameEntry.set_text(app.name) self.nameEntry.connect("activate", lambda widget: self.response(gtk.RESPONSE_OK)) self.nameEntry.show() table.attach(self.nameEntry, 1, 2, 0, 1, gtk.EXPAND|gtk.FILL, gtk.EXPAND, 10, 5)
|
a22737888e184f7e3831dc1540713597c843c940 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/a22737888e184f7e3831dc1540713597c843c940/driconf_simpleui.py
|
DataPixmap.window.realize() style = DataPixmap.window.get_style() pixmap, mask = create_pixmap_from_xpm_d(DataPixmap.window.get_window(), style.bg[STATE_NORMAL], data) GtkPixmap.__init__ (self, pixmap, mask) class MessageDialog (GtkDialog):
|
gtk.Image.__init__ (self) pixmap, mask = gtk.gdk.pixmap_colormap_create_from_xpm_d(None, self.window.get_colormap(), None, data) self.set_from_pixmap (pixmap, mask) class MessageDialog (gtk.Dialog):
|
def __init__ (self, data): """ Constructor. """ DataPixmap.window.realize() style = DataPixmap.window.get_style() pixmap, mask = create_pixmap_from_xpm_d(DataPixmap.window.get_window(), style.bg[STATE_NORMAL], data) GtkPixmap.__init__ (self, pixmap, mask)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkDialog.__init__ (self)
|
gtk.Dialog.__init__ (self)
|
def __init__ (self, title, message, buttons = ["OK"], callback = None, modal = TRUE): """ Constructor. """ GtkDialog.__init__ (self) if mainWindow: self.set_transient_for (mainWindow) self.callback = callback self.set_title (title) first = None for name in buttons: button = GtkButton (name) button.set_flags (CAN_DEFAULT) button.connect ("clicked", self.clickedSignal, name) button.show() self.action_area.pack_start (button, TRUE, FALSE, 10) if not first: first = button hbox = GtkHBox() label = GtkLabel (message) label.set_justify (JUSTIFY_LEFT) label.set_line_wrap (TRUE) label.show() hbox.pack_start (label, TRUE, TRUE, 20) hbox.show() self.vbox.pack_start (hbox, TRUE, TRUE, 10) first.grab_default() self.set_modal (modal) self.show()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
button = GtkButton (name) button.set_flags (CAN_DEFAULT)
|
button = gtk.Button (name) button.set_flags (gtk.CAN_DEFAULT)
|
def __init__ (self, title, message, buttons = ["OK"], callback = None, modal = TRUE): """ Constructor. """ GtkDialog.__init__ (self) if mainWindow: self.set_transient_for (mainWindow) self.callback = callback self.set_title (title) first = None for name in buttons: button = GtkButton (name) button.set_flags (CAN_DEFAULT) button.connect ("clicked", self.clickedSignal, name) button.show() self.action_area.pack_start (button, TRUE, FALSE, 10) if not first: first = button hbox = GtkHBox() label = GtkLabel (message) label.set_justify (JUSTIFY_LEFT) label.set_line_wrap (TRUE) label.show() hbox.pack_start (label, TRUE, TRUE, 20) hbox.show() self.vbox.pack_start (hbox, TRUE, TRUE, 10) first.grab_default() self.set_modal (modal) self.show()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
hbox = GtkHBox() label = GtkLabel (message) label.set_justify (JUSTIFY_LEFT)
|
hbox = gtk.HBox() label = gtk.Label (message) label.set_justify (gtk.JUSTIFY_LEFT)
|
def __init__ (self, title, message, buttons = ["OK"], callback = None, modal = TRUE): """ Constructor. """ GtkDialog.__init__ (self) if mainWindow: self.set_transient_for (mainWindow) self.callback = callback self.set_title (title) first = None for name in buttons: button = GtkButton (name) button.set_flags (CAN_DEFAULT) button.connect ("clicked", self.clickedSignal, name) button.show() self.action_area.pack_start (button, TRUE, FALSE, 10) if not first: first = button hbox = GtkHBox() label = GtkLabel (message) label.set_justify (JUSTIFY_LEFT) label.set_line_wrap (TRUE) label.show() hbox.pack_start (label, TRUE, TRUE, 20) hbox.show() self.vbox.pack_start (hbox, TRUE, TRUE, 10) first.grab_default() self.set_modal (modal) self.show()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
class WrappingCheckButton (GtkCheckButton):
|
class WrappingCheckButton (gtk.CheckButton):
|
def clickedSignal (self, widget, name): """ Handler for clicked signals. """ if self.callback: self.callback (name) self.destroy()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
def __init__ (self, label, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0):
|
def __init__ (self, label, justify=gtk.JUSTIFY_LEFT, wrap=TRUE, width=-1, height=-1):
|
def __init__ (self, label, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkCheckButton.__init__ (self) checkHBox = GtkHBox() checkLabel = GtkLabel(label) checkLabel.set_justify (justify) checkLabel.set_line_wrap (wrap) checkLabel.set_usize (width, height) checkLabel.show() checkHBox.pack_start (checkLabel, FALSE, FALSE, 0) checkHBox.show() self.add (checkHBox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkCheckButton.__init__ (self) checkHBox = GtkHBox() checkLabel = GtkLabel(label)
|
gtk.CheckButton.__init__ (self) checkHBox = gtk.HBox() checkLabel = gtk.Label(label)
|
def __init__ (self, label, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkCheckButton.__init__ (self) checkHBox = GtkHBox() checkLabel = GtkLabel(label) checkLabel.set_justify (justify) checkLabel.set_line_wrap (wrap) checkLabel.set_usize (width, height) checkLabel.show() checkHBox.pack_start (checkLabel, FALSE, FALSE, 0) checkHBox.show() self.add (checkHBox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
checkLabel.set_usize (width, height)
|
checkLabel.set_size_request (width, height)
|
def __init__ (self, label, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkCheckButton.__init__ (self) checkHBox = GtkHBox() checkLabel = GtkLabel(label) checkLabel.set_justify (justify) checkLabel.set_line_wrap (wrap) checkLabel.set_usize (width, height) checkLabel.show() checkHBox.pack_start (checkLabel, FALSE, FALSE, 0) checkHBox.show() self.add (checkHBox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
class WrappingOptionMenu (GtkButton): """ Something that looks similar to a GtkOptionMenu ...
|
class WrappingOptionMenu (gtk.Button): """ Something that looks similar to a gtk.OptionMenu ...
|
def __init__ (self, label, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkCheckButton.__init__ (self) checkHBox = GtkHBox() checkLabel = GtkLabel(label) checkLabel.set_justify (justify) checkLabel.set_line_wrap (wrap) checkLabel.set_usize (width, height) checkLabel.show() checkHBox.pack_start (checkLabel, FALSE, FALSE, 0) checkHBox.show() self.add (checkHBox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0):
|
def __init__ (self, optValList, callback, justify=gtk.JUSTIFY_LEFT, wrap=TRUE, width=-1, height=-1):
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkButton.__init__ (self)
|
gtk.Button.__init__ (self)
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT)
|
hbox = gtk.HBox() arrow = gtk.Arrow (gtk.ARROW_DOWN, gtk.SHADOW_OUT)
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.label = GtkLabel(firstOpt)
|
self.label = gtk.Label(firstOpt)
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.label.set_usize (width, height)
|
self.label.set_size_request (width, height)
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.menu = GtkMenu()
|
self.menu = gtk.Menu()
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
item = GtkMenuItem (opt)
|
item = gtk.MenuItem (opt)
|
def __init__ (self, optValList, callback, justify=JUSTIFY_LEFT, wrap=TRUE, width=0, height=0): """ Constructor. """ GtkButton.__init__ (self) self.callback = callback self.optDict = {} self.valDict = {} for opt,val in optValList: self.optDict[opt] = val self.valDict[val] = opt firstOpt,firstVal = optValList[len(optValList)-1] self.value = firstVal hbox = GtkHBox() arrow = GtkArrow (ARROW_DOWN, SHADOW_OUT) arrow.show() self.label = GtkLabel(firstOpt) self.label.set_justify (justify) self.label.set_line_wrap (wrap) self.label.set_usize (width, height) self.label.show() hbox.pack_start (self.label, TRUE, FALSE, 5) hbox.pack_start (arrow, FALSE, FALSE, 0) hbox.show() self.add (hbox) self.menu = GtkMenu() for opt,val in optValList: item = GtkMenuItem (opt) item.connect("activate", self.menuSelect, opt) item.show() self.menu.append (item) self.connect("event", self.buttonPress)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
if event.type == GDK.BUTTON_PRESS:
|
if event.type == gtk.gdk.BUTTON_PRESS:
|
def buttonPress (self, widget, event): """ Popup the menu. """ if event.type == GDK.BUTTON_PRESS: self.menu.popup(None, None, None, event.button, event.time) return TRUE else: return FALSE
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.check = WrappingCheckButton (desc.encode(encoding), width=200)
|
self.check = WrappingCheckButton (desc, width=200)
|
def __init__ (self, page, i, opt): """ Constructor. """ self.page = page self.opt = opt typeString = opt.type if opt.valid: typeString = typeString+" ["+ \ reduce(lambda x,y: x+','+y, map(str,opt.valid))+"]" # a check button with an option description desc = opt.getDesc([lang]) if desc != None: desc = desc.text else: desc = u"(no description available)" self.check = WrappingCheckButton (desc.encode(encoding), width=200) self.check.set_active (page.app.options.has_key (opt.name)) self.check.set_sensitive (page.app.device.config.writable) self.check.connect ("clicked", self.checkOpt) tooltipString = str(opt) page.tooltips.set_tip (self.check, tooltipString.encode(encoding)) self.check.show() page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5) # a button to reset the option to its default value sensitive = self.check.get_active() and page.app.device.config.writable self.resetButton = GtkButton () pixmap = DataPixmap (tb_undo_xpm) pixmap.show() self.resetButton.add (pixmap) self.resetButton.set_relief (RELIEF_NONE) self.resetButton.set_sensitive (sensitive) self.resetButton.connect ("clicked", self.resetOpt) self.resetButton.show() page.table.attach (self.resetButton, 2, 3, i, i+1, 0, 0, 5, 5)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
page.tooltips.set_tip (self.check, tooltipString.encode(encoding))
|
page.tooltips.set_tip (self.check, tooltipString)
|
def __init__ (self, page, i, opt): """ Constructor. """ self.page = page self.opt = opt typeString = opt.type if opt.valid: typeString = typeString+" ["+ \ reduce(lambda x,y: x+','+y, map(str,opt.valid))+"]" # a check button with an option description desc = opt.getDesc([lang]) if desc != None: desc = desc.text else: desc = u"(no description available)" self.check = WrappingCheckButton (desc.encode(encoding), width=200) self.check.set_active (page.app.options.has_key (opt.name)) self.check.set_sensitive (page.app.device.config.writable) self.check.connect ("clicked", self.checkOpt) tooltipString = str(opt) page.tooltips.set_tip (self.check, tooltipString.encode(encoding)) self.check.show() page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5) # a button to reset the option to its default value sensitive = self.check.get_active() and page.app.device.config.writable self.resetButton = GtkButton () pixmap = DataPixmap (tb_undo_xpm) pixmap.show() self.resetButton.add (pixmap) self.resetButton.set_relief (RELIEF_NONE) self.resetButton.set_sensitive (sensitive) self.resetButton.connect ("clicked", self.resetOpt) self.resetButton.show() page.table.attach (self.resetButton, 2, 3, i, i+1, 0, 0, 5, 5)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5)
|
page.table.attach (self.check, 0, 1, i, i+1, gtk.EXPAND|gtk.FILL, 0, 5, 5)
|
def __init__ (self, page, i, opt): """ Constructor. """ self.page = page self.opt = opt typeString = opt.type if opt.valid: typeString = typeString+" ["+ \ reduce(lambda x,y: x+','+y, map(str,opt.valid))+"]" # a check button with an option description desc = opt.getDesc([lang]) if desc != None: desc = desc.text else: desc = u"(no description available)" self.check = WrappingCheckButton (desc.encode(encoding), width=200) self.check.set_active (page.app.options.has_key (opt.name)) self.check.set_sensitive (page.app.device.config.writable) self.check.connect ("clicked", self.checkOpt) tooltipString = str(opt) page.tooltips.set_tip (self.check, tooltipString.encode(encoding)) self.check.show() page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5) # a button to reset the option to its default value sensitive = self.check.get_active() and page.app.device.config.writable self.resetButton = GtkButton () pixmap = DataPixmap (tb_undo_xpm) pixmap.show() self.resetButton.add (pixmap) self.resetButton.set_relief (RELIEF_NONE) self.resetButton.set_sensitive (sensitive) self.resetButton.connect ("clicked", self.resetOpt) self.resetButton.show() page.table.attach (self.resetButton, 2, 3, i, i+1, 0, 0, 5, 5)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.resetButton = GtkButton ()
|
self.resetButton = gtk.Button ()
|
def __init__ (self, page, i, opt): """ Constructor. """ self.page = page self.opt = opt typeString = opt.type if opt.valid: typeString = typeString+" ["+ \ reduce(lambda x,y: x+','+y, map(str,opt.valid))+"]" # a check button with an option description desc = opt.getDesc([lang]) if desc != None: desc = desc.text else: desc = u"(no description available)" self.check = WrappingCheckButton (desc.encode(encoding), width=200) self.check.set_active (page.app.options.has_key (opt.name)) self.check.set_sensitive (page.app.device.config.writable) self.check.connect ("clicked", self.checkOpt) tooltipString = str(opt) page.tooltips.set_tip (self.check, tooltipString.encode(encoding)) self.check.show() page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5) # a button to reset the option to its default value sensitive = self.check.get_active() and page.app.device.config.writable self.resetButton = GtkButton () pixmap = DataPixmap (tb_undo_xpm) pixmap.show() self.resetButton.add (pixmap) self.resetButton.set_relief (RELIEF_NONE) self.resetButton.set_sensitive (sensitive) self.resetButton.connect ("clicked", self.resetOpt) self.resetButton.show() page.table.attach (self.resetButton, 2, 3, i, i+1, 0, 0, 5, 5)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.resetButton.set_relief (RELIEF_NONE)
|
self.resetButton.set_relief (gtk.RELIEF_NONE)
|
def __init__ (self, page, i, opt): """ Constructor. """ self.page = page self.opt = opt typeString = opt.type if opt.valid: typeString = typeString+" ["+ \ reduce(lambda x,y: x+','+y, map(str,opt.valid))+"]" # a check button with an option description desc = opt.getDesc([lang]) if desc != None: desc = desc.text else: desc = u"(no description available)" self.check = WrappingCheckButton (desc.encode(encoding), width=200) self.check.set_active (page.app.options.has_key (opt.name)) self.check.set_sensitive (page.app.device.config.writable) self.check.connect ("clicked", self.checkOpt) tooltipString = str(opt) page.tooltips.set_tip (self.check, tooltipString.encode(encoding)) self.check.show() page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5) # a button to reset the option to its default value sensitive = self.check.get_active() and page.app.device.config.writable self.resetButton = GtkButton () pixmap = DataPixmap (tb_undo_xpm) pixmap.show() self.resetButton.add (pixmap) self.resetButton.set_relief (RELIEF_NONE) self.resetButton.set_sensitive (sensitive) self.resetButton.connect ("clicked", self.resetOpt) self.resetButton.show() page.table.attach (self.resetButton, 2, 3, i, i+1, 0, 0, 5, 5)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
page.table.attach (self.widget, 1, 2, i, i+1, FILL, 0, 5, 5)
|
page.table.attach (self.widget, 1, 2, i, i+1, gtk.FILL, 0, 5, 5)
|
def __init__ (self, page, i, opt): """ Constructor. """ self.page = page self.opt = opt typeString = opt.type if opt.valid: typeString = typeString+" ["+ \ reduce(lambda x,y: x+','+y, map(str,opt.valid))+"]" # a check button with an option description desc = opt.getDesc([lang]) if desc != None: desc = desc.text else: desc = u"(no description available)" self.check = WrappingCheckButton (desc.encode(encoding), width=200) self.check.set_active (page.app.options.has_key (opt.name)) self.check.set_sensitive (page.app.device.config.writable) self.check.connect ("clicked", self.checkOpt) tooltipString = str(opt) page.tooltips.set_tip (self.check, tooltipString.encode(encoding)) self.check.show() page.table.attach (self.check, 0, 1, i, i+1, EXPAND|FILL, 0, 5, 5) # a button to reset the option to its default value sensitive = self.check.get_active() and page.app.device.config.writable self.resetButton = GtkButton () pixmap = DataPixmap (tb_undo_xpm) pixmap.show() self.resetButton.add (pixmap) self.resetButton.set_relief (RELIEF_NONE) self.resetButton.set_sensitive (sensitive) self.resetButton.connect ("clicked", self.resetOpt) self.resetButton.show() page.table.attach (self.resetButton, 2, 3, i, i+1, 0, 0, 5, 5)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.toggleLabel = GtkLabel()
|
self.toggleLabel = gtk.Label()
|
def initWidget (self, opt, value, valid=1): """ Initialize the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.widget = GtkToggleButton ()
|
self.widget = gtk.ToggleButton ()
|
def initWidget (self, opt, value, valid=1): """ Initialize the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
adjustment = GtkAdjustment (value, opt.valid[0].start,
|
adjustment = gtk.Adjustment (value, opt.valid[0].start,
|
def initWidget (self, opt, value, valid=1): """ Initialize the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.widget = GtkSpinButton (adjustment, digits=0)
|
self.widget = gtk.SpinButton (adjustment, digits=0)
|
def initWidget (self, opt, value, valid=1): """ Initialize the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
string = desc.enums[v].encode(encoding)
|
string = desc.enums[v]
|
def initWidget (self, opt, value, valid=1): """ Initialize the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.widget = GtkEntry ()
|
self.widget = gtk.Entry ()
|
def initWidget (self, opt, value, valid=1): """ Initialize the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
if self.widget.__class__ == GtkToggleButton:
|
if self.widget.__class__ == gtk.ToggleButton:
|
def updateWidget (self, value, valid=1): """ Update the option widget to a new value. """ active = self.check.get_active() if self.widget.__class__ == GtkToggleButton: if value: self.toggleLabel.set_text ("Yes") else: self.toggleLabel.set_text ("No") self.widget.set_active (value) elif self.widget.__class__ == GtkSpinButton: self.widget.set_value (value) elif self.widget.__class__ == WrappingOptionMenu: return self.widget.setValue(str(value)) elif self.widget.__class__ == GtkEntry: if self.opt.type == "bool" and valid: if value: newText = "true" else: newText = "false" else: newText = str(value) # only set new text if it changed, otherwise the changed signal # is triggered without a real value change if newText != self.widget.get_text(): self.widget.set_text (newText) self.check.set_active (active)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
elif self.widget.__class__ == GtkSpinButton:
|
elif self.widget.__class__ == gtk.SpinButton:
|
def updateWidget (self, value, valid=1): """ Update the option widget to a new value. """ active = self.check.get_active() if self.widget.__class__ == GtkToggleButton: if value: self.toggleLabel.set_text ("Yes") else: self.toggleLabel.set_text ("No") self.widget.set_active (value) elif self.widget.__class__ == GtkSpinButton: self.widget.set_value (value) elif self.widget.__class__ == WrappingOptionMenu: return self.widget.setValue(str(value)) elif self.widget.__class__ == GtkEntry: if self.opt.type == "bool" and valid: if value: newText = "true" else: newText = "false" else: newText = str(value) # only set new text if it changed, otherwise the changed signal # is triggered without a real value change if newText != self.widget.get_text(): self.widget.set_text (newText) self.check.set_active (active)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
elif self.widget.__class__ == GtkEntry:
|
elif self.widget.__class__ == gtk.Entry:
|
def updateWidget (self, value, valid=1): """ Update the option widget to a new value. """ active = self.check.get_active() if self.widget.__class__ == GtkToggleButton: if value: self.toggleLabel.set_text ("Yes") else: self.toggleLabel.set_text ("No") self.widget.set_active (value) elif self.widget.__class__ == GtkSpinButton: self.widget.set_value (value) elif self.widget.__class__ == WrappingOptionMenu: return self.widget.setValue(str(value)) elif self.widget.__class__ == GtkEntry: if self.opt.type == "bool" and valid: if value: newText = "true" else: newText = "false" else: newText = str(value) # only set new text if it changed, otherwise the changed signal # is triggered without a real value change if newText != self.widget.get_text(): self.widget.set_text (newText) self.check.set_active (active)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
elif self.widget.__class__ == GtkToggleButton:
|
elif self.widget.__class__ == gtk.ToggleButton:
|
def getValue (self): """ Get the current value from the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
elif self.widget.__class__ == GtkSpinButton:
|
elif self.widget.__class__ == gtk.SpinButton:
|
def getValue (self): """ Get the current value from the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
elif self.widget.__class__ == GtkEntry:
|
elif self.widget.__class__ == gtk.Entry:
|
def getValue (self): """ Get the current value from the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
if self.widget.__class__ == GtkToggleButton:
|
if self.widget.__class__ == gtk.ToggleButton:
|
def activateSignal (self, widget, dummy=None): """ Handler for 'widget was activated by the user'. """ if self.widget.__class__ == GtkToggleButton: value = self.widget.get_active() if value: self.toggleLabel.set_text ("Yes") else: self.toggleLabel.set_text ("No") self.page.optionModified (self)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkEntry widgets should ever give invalid values in practice.
|
gtk.Entry widgets should ever give invalid values in practice.
|
def validate (self): """ Validate the current value from the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
if self.widget.__class__ == GtkEntry: style = self.widget.get_style().copy() style.fg[STATE_NORMAL] = self.widget.get_colormap().alloc(65535, 0, 0) self.widget.set_style (style) else: if self.widget.__class__ == GtkEntry: self.widget.set_rc_style()
|
if self.widget.__class__ == gtk.Entry: self.widget.modify_text (gtk.STATE_NORMAL, self.widget.\ get_colormap().alloc(65535, 0, 0)) else: if self.widget.__class__ == gtk.Entry: self.widget.set_style (None)
|
def validate (self): """ Validate the current value from the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
class SectionPage (GtkScrolledWindow):
|
class SectionPage (gtk.ScrolledWindow):
|
def validate (self): """ Validate the current value from the option widget.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.set_usize (500, 200)
|
gtk.ScrolledWindow.__init__ (self) self.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.set_size_request (500, 200)
|
def __init__ (self, optSection, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.set_usize (500, 200) self.optSection = optSection self.app = app self.tooltips = GtkTooltips() self.table = GtkTable (len(optSection.optList), 3) self.optLines = [] for i in range (len(optSection.optList)): self.optLines.append (OptionLine (self, i, optSection.optList[i])) self.table.show() self.add_with_viewport (self.table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.tooltips = GtkTooltips() self.table = GtkTable (len(optSection.optList), 3)
|
self.tooltips = gtk.Tooltips() self.table = gtk.Table (len(optSection.optList), 3)
|
def __init__ (self, optSection, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.set_usize (500, 200) self.optSection = optSection self.app = app self.tooltips = GtkTooltips() self.table = GtkTable (len(optSection.optList), 3) self.optLines = [] for i in range (len(optSection.optList)): self.optLines.append (OptionLine (self, i, optSection.optList[i])) self.table.show() self.add_with_viewport (self.table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
class UnknownSectionPage(GtkScrolledWindow):
|
class UnknownSectionPage(gtk.ScrolledWindow):
|
def commit (self): """ Commit the widget settings. """ for optLine in self.optLines: name = optLine.opt.name value = optLine.getValue() if value == None and self.app.options.has_key(name): del self.app.options[name] self.app.device.config.modifiedCallback() elif value != None: if not self.app.options.has_key(name) or \ (self.app.options.has_key(name) and \ value != self.app.options[name]): self.app.device.config.modifiedCallback() self.app.options[name] = value
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC)
|
gtk.ScrolledWindow.__init__ (self) self.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
def __init__ (self, driver, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.app = app # copy options (dict function does not exist in Python 2.1 :( ) self.opts = {} for name,val in app.options.items(): self.opts[name] = val # remove all options known to the driver for sect in driver.optSections: for opt in sect.optList: if self.opts.has_key (opt.name): del self.opts[opt.name] # short cut if len(self.opts) == 0: return # list all remaining options here self.list = GtkCList(2, ["Option", "Value"]) for name,val in self.opts.items(): self.list.append ([str(name),str(val)]) self.list.set_column_justification (1, JUSTIFY_RIGHT) self.list.columns_autosize() self.list.show() self.vbox = GtkVBox() self.vbox.pack_start (self.list, TRUE, TRUE, 0) self.removeButton = GtkButton ("Remove") self.removeButton.show() self.removeButton.connect ("clicked", self.removeSelection) self.vbox.pack_start (self.removeButton, FALSE, FALSE, 0) self.vbox.show() self.add_with_viewport (self.vbox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.list = GtkCList(2, ["Option", "Value"])
|
self.list = gtk.CList(2, ["Option", "Value"])
|
def __init__ (self, driver, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.app = app # copy options (dict function does not exist in Python 2.1 :( ) self.opts = {} for name,val in app.options.items(): self.opts[name] = val # remove all options known to the driver for sect in driver.optSections: for opt in sect.optList: if self.opts.has_key (opt.name): del self.opts[opt.name] # short cut if len(self.opts) == 0: return # list all remaining options here self.list = GtkCList(2, ["Option", "Value"]) for name,val in self.opts.items(): self.list.append ([str(name),str(val)]) self.list.set_column_justification (1, JUSTIFY_RIGHT) self.list.columns_autosize() self.list.show() self.vbox = GtkVBox() self.vbox.pack_start (self.list, TRUE, TRUE, 0) self.removeButton = GtkButton ("Remove") self.removeButton.show() self.removeButton.connect ("clicked", self.removeSelection) self.vbox.pack_start (self.removeButton, FALSE, FALSE, 0) self.vbox.show() self.add_with_viewport (self.vbox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.list.set_column_justification (1, JUSTIFY_RIGHT)
|
self.list.set_column_justification (1, gtk.JUSTIFY_RIGHT)
|
def __init__ (self, driver, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.app = app # copy options (dict function does not exist in Python 2.1 :( ) self.opts = {} for name,val in app.options.items(): self.opts[name] = val # remove all options known to the driver for sect in driver.optSections: for opt in sect.optList: if self.opts.has_key (opt.name): del self.opts[opt.name] # short cut if len(self.opts) == 0: return # list all remaining options here self.list = GtkCList(2, ["Option", "Value"]) for name,val in self.opts.items(): self.list.append ([str(name),str(val)]) self.list.set_column_justification (1, JUSTIFY_RIGHT) self.list.columns_autosize() self.list.show() self.vbox = GtkVBox() self.vbox.pack_start (self.list, TRUE, TRUE, 0) self.removeButton = GtkButton ("Remove") self.removeButton.show() self.removeButton.connect ("clicked", self.removeSelection) self.vbox.pack_start (self.removeButton, FALSE, FALSE, 0) self.vbox.show() self.add_with_viewport (self.vbox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.vbox = GtkVBox()
|
self.vbox = gtk.VBox()
|
def __init__ (self, driver, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.app = app # copy options (dict function does not exist in Python 2.1 :( ) self.opts = {} for name,val in app.options.items(): self.opts[name] = val # remove all options known to the driver for sect in driver.optSections: for opt in sect.optList: if self.opts.has_key (opt.name): del self.opts[opt.name] # short cut if len(self.opts) == 0: return # list all remaining options here self.list = GtkCList(2, ["Option", "Value"]) for name,val in self.opts.items(): self.list.append ([str(name),str(val)]) self.list.set_column_justification (1, JUSTIFY_RIGHT) self.list.columns_autosize() self.list.show() self.vbox = GtkVBox() self.vbox.pack_start (self.list, TRUE, TRUE, 0) self.removeButton = GtkButton ("Remove") self.removeButton.show() self.removeButton.connect ("clicked", self.removeSelection) self.vbox.pack_start (self.removeButton, FALSE, FALSE, 0) self.vbox.show() self.add_with_viewport (self.vbox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.removeButton = GtkButton ("Remove")
|
self.removeButton = gtk.Button ("Remove")
|
def __init__ (self, driver, app): """ Constructor. """ GtkScrolledWindow.__init__ (self) self.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) self.app = app # copy options (dict function does not exist in Python 2.1 :( ) self.opts = {} for name,val in app.options.items(): self.opts[name] = val # remove all options known to the driver for sect in driver.optSections: for opt in sect.optList: if self.opts.has_key (opt.name): del self.opts[opt.name] # short cut if len(self.opts) == 0: return # list all remaining options here self.list = GtkCList(2, ["Option", "Value"]) for name,val in self.opts.items(): self.list.append ([str(name),str(val)]) self.list.set_column_justification (1, JUSTIFY_RIGHT) self.list.columns_autosize() self.list.show() self.vbox = GtkVBox() self.vbox.pack_start (self.list, TRUE, TRUE, 0) self.removeButton = GtkButton ("Remove") self.removeButton.show() self.removeButton.connect ("clicked", self.removeSelection) self.vbox.pack_start (self.removeButton, FALSE, FALSE, 0) self.vbox.show() self.add_with_viewport (self.vbox)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
class DriverPanel (GtkFrame):
|
class DriverPanel (gtk.Frame):
|
def removeSelection (self, widget): """ Remove the selected items from the list and app config. """ for row in self.list.selection: name = self.list.get_text (row, 0) del self.app.options[name] self.list.remove (row) self.app.device.config.modifiedCallback()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkFrame.__init__ (self, "Application: " + app.name)
|
gtk.Frame.__init__ (self, "Application: " + app.name)
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:")
|
table = gtk.Table(2, 2) execLabel = gtk.Label ("Executable:")
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.execEntry = GtkEntry()
|
self.execEntry = gtk.Entry()
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook()
|
table.attach (self.execEntry, 1, 2, 0, 1, gtk.EXPAND|gtk.FILL, 0, 5, 5) notebook = gtk.Notebook()
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
sectLabel = GtkLabel (desc.encode(encoding))
|
sectLabel = gtk.Label (desc)
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
sectLabel = GtkLabel ("(no description)")
|
sectLabel = gtk.Label ("(no description)")
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
unknownLabel = GtkLabel ("Unknown")
|
unknownLabel = gtk.Label ("Unknown")
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5)
|
table.attach (notebook, 0, 2, 1, 2, gtk.FILL, gtk.EXPAND|gtk.FILL, 5, 5)
|
def __init__ (self, driver, app): """ Constructor. """ GtkFrame.__init__ (self, "Application: " + app.name) self.driver = driver self.app = app table = GtkTable(2, 2) execLabel = GtkLabel ("Executable:") execLabel.show() table.attach (execLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.execEntry = GtkEntry() if app.executable != None: self.execEntry.set_text (app.executable) self.execEntry.set_sensitive (app.device.config.writable) self.execEntry.connect ("changed", self.execChanged) self.execEntry.show() table.attach (self.execEntry, 1, 2, 0, 1, EXPAND|FILL, 0, 5, 5) notebook = GtkNotebook() self.sectPages = [] self.sectLabels = [] for sect in driver.optSections: sectPage = SectionPage (sect, app) sectPage.show() desc = sect.getDesc([lang]) if desc: sectLabel = GtkLabel (desc.encode(encoding)) else: sectLabel = GtkLabel ("(no description)") sectLabel.show() notebook.append_page (sectPage, sectLabel) self.sectPages.append (sectPage) self.sectLabels.append (sectLabel) unknownPage = UnknownSectionPage (driver, app) if len(unknownPage.opts) > 0: unknownPage.show() unknownLabel = GtkLabel ("Unknown") unknownLabel.show() notebook.append_page (unknownPage, unknownLabel) self.sectPages.append (unknownPage) self.sectLabels.append (sectLabel) MessageDialog ("Notice", "This application configuration contains options that are not known to the driver. Either you edited your configuration file manually or the driver configuration changed. See the page named \"Unknown\" for details. It is probably safe to remove these options. Otherwise they are left unchanged.", modal=FALSE) self.validate() notebook.show() table.attach (notebook, 0, 2, 1, 2, FILL, EXPAND|FILL, 5, 5) table.show() self.add (table)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
style = self.sectLabels[index].get_style().copy() style.fg[STATE_NORMAL] = self.sectLabels[index].get_colormap().alloc(65535, 0, 0) self.sectLabels[index].set_style(style)
|
self.sectLabels[index].modify_fg ( gtk.STATE_NORMAL, self.sectLabels[index].get_colormap().alloc(65535, 0, 0))
|
def validate (self): """ Validate the configuration.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.sectLabels[index].set_rc_style()
|
self.sectLabels[index].set_style (None)
|
def validate (self): """ Validate the configuration.
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
class BasicDialog (GtkDialog):
|
class BasicDialog (gtk.Dialog):
|
def renameApp (self): """ Change the application name. """ self.set_label ("Application: " + self.app.name)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
GtkDialog.__init__ (self)
|
gtk.Dialog.__init__ (self)
|
def __init__ (self, title, callback): GtkDialog.__init__ (self) self.set_transient_for (mainWindow) self.set_title (title) self.callback = callback ok = GtkButton ("OK") ok.set_flags (CAN_DEFAULT) ok.connect ("clicked", self.okSignal) ok.show() self.action_area.pack_start (ok, TRUE, FALSE, 10) cancel = GtkButton ("Cancel") cancel.set_flags (CAN_DEFAULT) cancel.connect ("clicked", self.cancelSignal) cancel.show() self.action_area.pack_start (cancel, TRUE, FALSE, 10) ok.grab_default() self.set_modal (TRUE)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
ok = GtkButton ("OK")
|
ok = gtk.Button ("OK")
|
def __init__ (self, title, callback): GtkDialog.__init__ (self) self.set_transient_for (mainWindow) self.set_title (title) self.callback = callback ok = GtkButton ("OK") ok.set_flags (CAN_DEFAULT) ok.connect ("clicked", self.okSignal) ok.show() self.action_area.pack_start (ok, TRUE, FALSE, 10) cancel = GtkButton ("Cancel") cancel.set_flags (CAN_DEFAULT) cancel.connect ("clicked", self.cancelSignal) cancel.show() self.action_area.pack_start (cancel, TRUE, FALSE, 10) ok.grab_default() self.set_modal (TRUE)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
cancel = GtkButton ("Cancel")
|
cancel = gtk.Button ("Cancel")
|
def __init__ (self, title, callback): GtkDialog.__init__ (self) self.set_transient_for (mainWindow) self.set_title (title) self.callback = callback ok = GtkButton ("OK") ok.set_flags (CAN_DEFAULT) ok.connect ("clicked", self.okSignal) ok.show() self.action_area.pack_start (ok, TRUE, FALSE, 10) cancel = GtkButton ("Cancel") cancel.set_flags (CAN_DEFAULT) cancel.connect ("clicked", self.cancelSignal) cancel.show() self.action_area.pack_start (cancel, TRUE, FALSE, 10) ok.grab_default() self.set_modal (TRUE)
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
hbox = GtkHBox() label = GtkLabel ("Name:")
|
hbox = gtk.HBox() label = gtk.Label ("Name:")
|
def __init__ (self, title, callback, name, data): BasicDialog.__init__ (self, title, callback) self.data = data hbox = GtkHBox() label = GtkLabel ("Name:") label.show() hbox.pack_start (label, TRUE, TRUE, 10) self.entry = GtkEntry() self.entry.set_text (name) self.entry.select_region (0, len(name)) self.entry.connect ("activate", self.okSignal) self.entry.show() hbox.pack_start (self.entry, TRUE, TRUE, 10) hbox.show() self.vbox.pack_start (hbox, TRUE, TRUE, 10) self.show() self.entry.grab_focus()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
self.entry = GtkEntry()
|
self.entry = gtk.Entry()
|
def __init__ (self, title, callback, name, data): BasicDialog.__init__ (self, title, callback) self.data = data hbox = GtkHBox() label = GtkLabel ("Name:") label.show() hbox.pack_start (label, TRUE, TRUE, 10) self.entry = GtkEntry() self.entry.set_text (name) self.entry.select_region (0, len(name)) self.entry.connect ("activate", self.okSignal) self.entry.show() hbox.pack_start (self.entry, TRUE, TRUE, 10) hbox.show() self.vbox.pack_start (hbox, TRUE, TRUE, 10) self.show() self.entry.grab_focus()
|
ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4580/ec17e2ee5c945ddc11ff8bcc0cdc586ae535e76d/driconf.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.