rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
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" |
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. |
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. |
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.s... | |
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. |
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" % n... |
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... |
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() #st... |
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... |
"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 d... |
self.highlightInvalid() self.widget.show() | def initWidget (self, opt, value): """ Initialize the option widget. | |
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... |
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) |
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_DEFAUL... |
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_DEFAUL... |
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_DEFAUL... |
class WrappingCheckButton (GtkCheckButton): | class WrappingCheckButton (gtk.CheckButton): | def clickedSignal (self, widget, name): """ Handler for clicked signals. """ if self.callback: self.callback (name) self.destroy() |
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_st... |
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_st... |
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_st... |
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_st... |
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(optValL... |
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(optValL... |
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(optValL... |
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(optValL... |
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(optValL... |
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(optValL... |
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(optValL... |
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 |
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: d... |
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: d... |
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: d... |
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: d... |
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: d... |
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: d... |
self.toggleLabel = GtkLabel() | self.toggleLabel = gtk.Label() | def initWidget (self, opt, value, valid=1): """ Initialize the option widget. |
self.widget = GtkToggleButton () | self.widget = gtk.ToggleButton () | def initWidget (self, opt, value, valid=1): """ Initialize the option widget. |
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. |
self.widget = GtkSpinButton (adjustment, digits=0) | self.widget = gtk.SpinButton (adjustment, digits=0) | def initWidget (self, opt, value, valid=1): """ Initialize the option widget. |
string = desc.enums[v].encode(encoding) | string = desc.enums[v] | def initWidget (self, opt, value, valid=1): """ Initialize the option widget. |
self.widget = GtkEntry () | self.widget = gtk.Entry () | def initWidget (self, opt, value, valid=1): """ Initialize the option widget. |
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__ == GtkSpinB... |
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__ == GtkSpinB... |
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__ == GtkSpinB... |
elif self.widget.__class__ == GtkToggleButton: | elif self.widget.__class__ == gtk.ToggleButton: | def getValue (self): """ Get the current value from the option widget. |
elif self.widget.__class__ == GtkSpinButton: | elif self.widget.__class__ == gtk.SpinButton: | def getValue (self): """ Get the current value from the option widget. |
elif self.widget.__class__ == GtkEntry: | elif self.widget.__class__ == gtk.Entry: | def getValue (self): """ Get the current value from the option widget. |
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) |
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. |
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. |
class SectionPage (GtkScrolledWindow): | class SectionPage (gtk.ScrolledWindow): | def validate (self): """ Validate the current value from the option widget. |
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 ... |
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 ... |
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 \... |
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 know... |
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 know... |
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 know... |
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 know... |
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 know... |
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() |
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 != N... |
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 != N... |
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 != N... |
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 != N... |
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 != N... |
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 != N... |
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 != N... |
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 != N... |
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. |
self.sectLabels[index].set_rc_style() | self.sectLabels[index].set_style (None) | def validate (self): """ Validate the configuration. |
class BasicDialog (GtkDialog): | class BasicDialog (gtk.Dialog): | def renameApp (self): """ Change the application name. """ self.set_label ("Application: " + self.app.name) |
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 ("Canc... |
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 ("Canc... |
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 ("Canc... |
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 (... |
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 (... |
table = GtkTable (2, 2) screenLabel = GtkLabel ("Screen:") | table = gtk.Table (2, 2) screenLabel = gtk.Label ("Screen:") | def __init__ (self, title, callback, data): BasicDialog.__init__ (self, title, callback) self.data = data table = GtkTable (2, 2) screenLabel = GtkLabel ("Screen:") screenLabel.show() table.attach (screenLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.screenCombo = GtkCombo() self.screenCombo.set_popdown_strings ( [""]+map(str,ran... |
self.screenCombo = GtkCombo() | self.screenCombo = gtk.Combo() | def __init__ (self, title, callback, data): BasicDialog.__init__ (self, title, callback) self.data = data table = GtkTable (2, 2) screenLabel = GtkLabel ("Screen:") screenLabel.show() table.attach (screenLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.screenCombo = GtkCombo() self.screenCombo.set_popdown_strings ( [""]+map(str,ran... |
table.attach (self.screenCombo, 1, 2, 0, 1, EXPAND|FILL, EXPAND, 5, 5) driverLabel = GtkLabel ("Driver:") | table.attach (self.screenCombo, 1, 2, 0, 1, gtk.EXPAND|gtk.FILL, gtk.EXPAND, 5, 5) driverLabel = gtk.Label ("Driver:") | def __init__ (self, title, callback, data): BasicDialog.__init__ (self, title, callback) self.data = data table = GtkTable (2, 2) screenLabel = GtkLabel ("Screen:") screenLabel.show() table.attach (screenLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.screenCombo = GtkCombo() self.screenCombo.set_popdown_strings ( [""]+map(str,ran... |
self.driverCombo = GtkCombo() | self.driverCombo = gtk.Combo() | def __init__ (self, title, callback, data): BasicDialog.__init__ (self, title, callback) self.data = data table = GtkTable (2, 2) screenLabel = GtkLabel ("Screen:") screenLabel.show() table.attach (screenLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.screenCombo = GtkCombo() self.screenCombo.set_popdown_strings ( [""]+map(str,ran... |
table.attach (self.driverCombo, 1, 2, 1, 2, EXPAND|FILL, EXPAND, 5, 5) | table.attach (self.driverCombo, 1, 2, 1, 2, gtk.EXPAND|gtk.FILL, gtk.EXPAND, 5, 5) | def __init__ (self, title, callback, data): BasicDialog.__init__ (self, title, callback) self.data = data table = GtkTable (2, 2) screenLabel = GtkLabel ("Screen:") screenLabel.show() table.attach (screenLabel, 0, 1, 0, 1, 0, 0, 5, 5) self.screenCombo = GtkCombo() self.screenCombo.set_popdown_strings ( [""]+map(str,ran... |
class ConfigTree (GtkCTree): | class ConfigTree (gtk.CTree): | def okSignal (self, widget): self.callback (self.screenCombo.entry.get_text(), self.driverCombo.entry.get_text(), self.data) self.destroy() |
GtkCTree.__init__ (self, 1, 0) self.set_usize (200, 0) | gtk.CTree.__init__ (self, 1, 0) self.set_size_request (200, -1) | def __init__ (self, configList): GtkCTree.__init__ (self, 1, 0) self.set_usize (200, 0) self.set_column_auto_resize (0, TRUE) self.set_selection_mode (SELECTION_BROWSE) self.defaultFg = self.get_style().fg[STATE_NORMAL] self.configList = [] for config in configList: self.addConfig (config) self.connect ("select_row", s... |
self.set_selection_mode (SELECTION_BROWSE) self.defaultFg = self.get_style().fg[STATE_NORMAL] | self.set_selection_mode (gtk.SELECTION_BROWSE) self.defaultFg = self.get_style().fg[gtk.STATE_NORMAL] | def __init__ (self, configList): GtkCTree.__init__ (self, 1, 0) self.set_usize (200, 0) self.set_column_auto_resize (0, TRUE) self.set_selection_mode (SELECTION_BROWSE) self.defaultFg = self.get_style().fg[STATE_NORMAL] self.configList = [] for config in configList: self.addConfig (config) self.connect ("select_row", s... |
style.fg[STATE_NORMAL] = self.defaultFg | style.fg[gtk.STATE_NORMAL] = self.defaultFg | 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[STATE_NORMAL] = self.defaultFg self.node_set_row_style(app.node, style) else: style = self.get_style().copy() style.fg[STATE_N... |
style.fg[STATE_NORMAL] = self.get_colormap().alloc(65535, 0, 0) | style.fg[gtk.STATE_NORMAL] = self.get_colormap().alloc(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[STATE_NORMAL] = self.defaultFg self.node_set_row_style(app.node, style) else: style = self.get_style().copy() style.fg[STATE_N... |
class MainWindow (GtkWindow): | class MainWindow (gtk.Window): | 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 ("Que... |
GtkWindow.__init__ (self) | gtk.Window.__init__ (self) | def __init__ (self, configList): GtkWindow.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", mainquit) self.connect ("delete_event", self.exitHandler) self.vbox = GtkVBox() self.paned = GtkHPaned() self.configTree = ConfigTree (configList) self.configTree.show() scrolledWindow = GtkScrolledW... |
self.connect ("destroy", mainquit) | self.connect ("destroy", gtk.mainquit) | def __init__ (self, configList): GtkWindow.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", mainquit) self.connect ("delete_event", self.exitHandler) self.vbox = GtkVBox() self.paned = GtkHPaned() self.configTree = ConfigTree (configList) self.configTree.show() scrolledWindow = GtkScrolledW... |
self.vbox = GtkVBox() self.paned = GtkHPaned() | self.vbox = gtk.VBox() self.paned = gtk.HPaned() | def __init__ (self, configList): GtkWindow.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", mainquit) self.connect ("delete_event", self.exitHandler) self.vbox = GtkVBox() self.paned = GtkHPaned() self.configTree = ConfigTree (configList) self.configTree.show() scrolledWindow = GtkScrolledW... |
scrolledWindow = GtkScrolledWindow () scrolledWindow.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC) | scrolledWindow = gtk.ScrolledWindow () scrolledWindow.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) | def __init__ (self, configList): GtkWindow.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", mainquit) self.connect ("delete_event", self.exitHandler) self.vbox = GtkVBox() self.paned = GtkHPaned() self.configTree = ConfigTree (configList) self.configTree.show() scrolledWindow = GtkScrolledW... |
self.toolbar = GtkToolbar (ORIENTATION_HORIZONTAL, TOOLBAR_BOTH) self.toolbar.set_button_relief (RELIEF_NONE) self.toolbar.set_space_style (TOOLBAR_SPACE_LINE) | self.toolbar = gtk.Toolbar () | def __init__ (self, configList): GtkWindow.__init__ (self) self.set_title ("DRI Configuration") self.connect ("destroy", mainquit) self.connect ("delete_event", self.exitHandler) self.vbox = GtkVBox() self.paned = GtkHPaned() self.configTree = ConfigTree (configList) self.configTree.show() scrolledWindow = GtkScrolledW... |
mainquit() | gtk.mainquit() | 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: mainquit() else: retu... |
mainquit() | gtk.mainquit() | def doExit (self, choice): if choice == "Yes": mainquit() |
if len(config.devices) > 0 and len(config.devices[0].apps) > 0: foundApp = config.devices[0].apps[0] if config.writable: | if not config.writable: continue for device in config.devices: if len(device.apps) > 0: foundApp = device.apps[0] | def findFirstWritableApp (self): foundApp = None for config in self.configList: if len(config.devices) > 0 and len(config.devices[0].apps) > 0: foundApp = config.devices[0].apps[0] if config.writable: break return foundApp |
2, app.device.config.writable and not self.driver, 3, app.device.config.writable) | 2, self.nameEditable, 3, self.valueEditable) | def __init__ (self, driver, app): """ Constructor. """ gtk.VBox.__init__ (self) scrolledWindow = gtk.ScrolledWindow () scrolledWindow.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.app = app self.driver = driver # copy options (dict function does not exist in Python 2.1 :( ) opts = {} for name,val in app.... |
self.store.set (self.store.append(), 0, str(name), 1, str(val), 2, True) | self.store.set (self.store.append(), 0, str(name), 1, str(val), 2, self.nameEditable, 3, self.valueEditable) | def newSetting (self, widget): """ Create a new setting. Choose a unique option name, that is unknown to the driver. """ name = "option" val = "" i = 0 while self.app.options.has_key(name) or \ self.driverOpts.has_key(name): i = i + 1 name = "option%d" % i self.app.options[name] = val self.opts.append (name) self.store... |
self.store.set (cursor, 0, str(name), 1, str(newVal), 2, True) | self.store.set (cursor, 0, str(name), 1, str(newVal), 2, self.nameEditable, 3, self.valueEditable) | def editedSignal (self, widget, row, newVal, value): row = int(row) name = self.opts[row] cursor = self.store.get_iter_first() for i in range(row): cursor = self.store.iter_next (cursor) if value: if self.app.options[name] == newVal: return self.app.options[name] = newVal self.store.set (cursor, 0, str(name), 1, str(ne... |
self.store.set (cursor, 0, str(name), 1, str(val), 2, True) | self.store.set (cursor, 0, str(name), 1, str(val), 2, self.nameEditable, 3, self.valueEditable) | def editedSignal (self, widget, row, newVal, value): row = int(row) name = self.opts[row] cursor = self.store.get_iter_first() for i in range(row): cursor = self.store.iter_next (cursor) if value: if self.app.options[name] == newVal: return self.app.options[name] = newVal self.store.set (cursor, 0, str(name), 1, str(ne... |
curNode = mainWindow.configTree.getSelection() if curNode.__class__ == dri.DRIConfig: | curNode = mainWindow.configTree.getSelection (allowNone=TRUE) if not curNode: mainWindow.deactivateButtons() elif curNode.__class__ == dri.DRIConfig: | def nodeModified (self, node, b=TRUE): if node.__class__ == dri.DRIConfig: config = node elif node.__class__ == dri.DeviceConfig: config = node.config elif node.__class__ == dri.AppConfig: config = node.device.config if config.isModified != b: config.isModified = b curNode = mainWindow.configTree.getSelection() if curN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.