def __init__ (self, host=None, encryption=None, parent=None): GObject.GObject.__init__ (self) self.cupsconn = authconn.Connection (host=host, encryption=encryption) self._host = host self._parent = parent self.getWidgets({"ServerSettingsDialog": ["ServerSettingsDialog", "chkServerBrowse", "chkServerShare", "chkServerShareAny", "chkServerRemoteAdmin", "chkServerAllowCancelAll", "chkServerLogDebug", "hboxServerBrowse", "rbPreserveJobFiles", "rbPreserveJobHistory", "rbPreserveJobNone", "tvBrowseServers", "frameBrowseServers", "btAdvServerAdd", "btAdvServerRemove"]}, domain=config.PACKAGE) problems = _UnobtrusiveButton (label=_("Problems?")) self.hboxServerBrowse.pack_end (problems, False, False, 0) problems.connect ('clicked', self.problems_clicked) problems.show () self.ServerSettingsDialog.connect ('response', self.on_response) # Signal handler IDs. self.handler_ids = {} self.dialog = self.ServerSettingsDialog self.browse_treeview = self.tvBrowseServers self.add = self.btAdvServerAdd self.remove = self.btAdvServerRemove selection = self.browse_treeview.get_selection () selection.set_mode (Gtk.SelectionMode.MULTIPLE) self._connect (selection, 'changed', self.on_treeview_selection_changed) for column in self.browse_treeview.get_columns(): self.browse_treeview.remove_column(column) col = Gtk.TreeViewColumn ('', Gtk.CellRendererText (), text=0) self.browse_treeview.append_column (col) self._fillAdvanced () self._fillBasic () if parent: self.dialog.set_transient_for (parent) self.connect_signals () self.dialog.show ()
cupshelpers.ppds.ppdMakeModelSplit (other_make_and_model) mfgcmp = cmp(our_mfg.lower(), other_mfg.lower()) if mfgcmp != 0: return mfgcmp mdlcmp = cmp(our_mdl.lower(), other_mdl.lower()) if mdlcmp != 0: return mdlcmp if self.sn == '' or other.sn == '': return 0 return cmp(self.sn, other.sn) if __name__ == '__main__': import authconn c = authconn.Connection() devices = cupshelpers.getDevices(c) physicaldevices = [] for device in devices.values(): physicaldevice = PhysicalDevice(device) try: i = physicaldevices.index(physicaldevice) physicaldevices[i].add_device(device) except ValueError: physicaldevices.append(physicaldevice) physicaldevices.sort() for physicaldevice in physicaldevices: print physicaldevice.get_info() devices = physicaldevice.get_devices()
def get_connection(self): return authconn.Connection(self.parent, lock=True)