rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if not self._uninst_srcdir: self._packages.append('gobject-introspection-1.0')
def __init__(self, options, get_type_functions): self._options = options self._get_type_functions = get_type_functions # We have to use the current directory to work around Unix # sysadmins who mount /tmp noexec self._tmpdir = tempfile.mkdtemp('', 'tmp-introspect', dir=os.getcwd())
if self._uninst_srcdir: args.append('-I' + os.path.join(self._uninst_srcdir, 'girepository'))
def _compile(self, output, *sources): # Not strictly speaking correct, but easier than parsing shell args = self._compiler_cmd.split() # Do not add -Wall when using init code as we do not include any # header of the library being introspected if self._compiler_cmd == 'gcc' and not self._options.init_sections: args.append('-Wall') pkgconfig_flags = self._run_pkgconfig('--cflags') if self._uninst_srcdir: args.append('-I' + os.path.join(self._uninst_srcdir, 'girepository')) args.extend(pkgconfig_flags) cflags = os.environ.get('CFLAGS') if (cflags): for iflag in cflags.split(): args.append(iflag) for include in self._options.cpp_includes: args.append('-I' + include) args.extend(['-c', '-o', output]) for source in sources: if not os.path.exists(source): raise CompilerError( "Could not find c source file: %s" % (source, )) args.extend(list(sources)) if not self._options.quiet: print "g-ir-scanner: compile: %s" % ( subprocess.list2cmdline(args), ) subprocess.check_call(args)
uninst_builddir = os.environ.get('UNINSTALLED_INTROSPECTION_BUILDDIR') if not uninst_builddir: proc = subprocess.Popen([self._pkgconfig_cmd, '--libs', 'gobject-introspection-1.0'], stdout=subprocess.PIPE) args.extend(proc.communicate()[0].split())
def _link(self, output, *sources): args = [] libtool = get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
if (uninst_builddir and self._options.libraries[0] == 'girepository-1.0'): continue
def _link(self, output, *sources): args = [] libtool = get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
if uninst_builddir: path = os.path.join(uninst_builddir, 'girepository', 'libgirepository-1.0.la') args.append(path)
def _link(self, output, *sources): args = [] libtool = get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
file_positions = None
file_positions = []
def log_node(self, log_type, node, text, context=None): """Log a warning, using information about file positions from
p.destroy_index = None
p.destroy_index = -1
def _fixup_param_destroy(self, parent, param): for p in parent.parameters: if p is not param and p.destroy_index == param.destroy_index: p.destroy_index = None
p.closure_index = None
p.closure_index = -1
def _fixup_param_closure(self, parent, param): for p in parent.parameters: if p is not param and p.closure_index == param.closure_index: p.closure_index = None
libtool_args = []
def _link(self, output, *sources): args = [] libtool = get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
libtool_args.append(library)
args.append(library)
def _link(self, output, *sources): args = [] libtool = get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
args.extend(libtool_args)
def _link(self, output, *sources): args = [] libtool = get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
if isinstance(node, (ast.Class, ast.Interface, ast.Record, ast.Union, ast.Enum, ast.Bitfield, ast.Callback)):
if isinstance(node, (ast.Class, ast.Interface, ast.Union, ast.Enum, ast.Bitfield, ast.Callback)):
def _pass_read_annotations(self, node, chain): if not node.namespace: return False if isinstance(node, ast.Alias): self._apply_annotations_alias(node, chain) if isinstance(node, ast.Function): self._apply_annotations_function(node, chain) if isinstance(node, ast.Callback): self._apply_annotations_callable(node, chain, block = self._get_block(node)) if isinstance(node, (ast.Class, ast.Interface, ast.Record, ast.Union, ast.Enum, ast.Bitfield, ast.Callback)): self._apply_annotations_annotated(node, self._get_block(node)) if isinstance(node, (ast.Class, ast.Interface, ast.Record, ast.Union)): block = self._get_block(node) for field in node.fields: self._apply_annotations_field(node, block, field) if isinstance(node, (ast.Class, ast.Interface)): for prop in node.properties: self._apply_annotations_property(node, prop) for sig in node.signals: self._apply_annotations_signal(node, sig) if isinstance(node, ast.Class): block = self._get_block(node) if block: tag = block.get(TAG_UNREF_FUNC) node.unref_func = tag.value if tag else None tag = block.get(TAG_REF_FUNC) node.ref_func = tag.value if tag else None tag = block.get(TAG_SET_VALUE_FUNC) node.set_value_func = tag.value if tag else None tag = block.get(TAG_GET_VALUE_FUNC) node.get_value_func = tag.value if tag else None return True
or (isinstance(target, (ast.Record, ast.Union)) and target.gtype_name is not None)):
or (isinstance(target, (ast.Record, ast.Union)) and (target.gtype_name is not None or target.foreign))):
def _get_transfer_default_return(self, parent, node): typeval = node.type basic = self._get_transfer_default_returntype_basic(typeval) if basic: return basic if not typeval.target_giname: return None target = self._transformer.lookup_typenode(typeval) if isinstance(target, ast.Alias): return self._get_transfer_default_returntype_basic(target.target) elif (isinstance(target, ast.Boxed) or (isinstance(target, (ast.Record, ast.Union)) and target.gtype_name is not None)): return ast.PARAM_TRANSFER_FULL elif isinstance(target, (ast.Enum, ast.Bitfield)): return ast.PARAM_TRANSFER_NONE # Handle constructors specially here elif isinstance(parent, ast.Function) and parent.is_constructor: if isinstance(target, ast.Class): initially_unowned_type = ast.Type(target_giname='GObject.InitiallyUnowned') initially_unowned = self._transformer.lookup_typenode(initially_unowned_type) if initially_unowned and self._is_gi_subclass(typeval, initially_unowned_type): return ast.PARAM_TRANSFER_NONE else: return ast.PARAM_TRANSFER_FULL elif isinstance(target, (ast.Record, ast.Union)): return ast.PARAM_TRANSFER_FULL else: assert False, "Invalid constructor" elif isinstance(target, (ast.Class, ast.Record, ast.Union)): # Explicitly no default for these return None else: return None
args = self._linker_cmd.split()
args.extend(self._linker_cmd.split())
def _link(self, output, *sources): args = [] libtool = utils.get_libtool_command(self._options) if libtool: args.extend(libtool) args.append('--mode=link') args.append('--tag=CC') args.append('--silent')
if OPT_ALLOW_NONE in options: node.allow_none = True
def _parse_param_ret_common(self, parent, node, tag): options = getattr(tag, 'options', {}) node.direction = self._extract_direction(node, options) container_type = self._extract_container_type( parent, node, options) if container_type is not None: node.type = container_type if node.direction is None: node.direction = self._guess_direction(node) node.transfer = self._extract_transfer(parent, node, options) if OPT_ALLOW_NONE in options: node.allow_none = True param_type = options.get(OPT_TYPE) if param_type: node.type = self._resolve(param_type.one(), node.type)
print widget_name, widget
def get_widget(self, widget_name): widget = gtk.glade.XML.get_widget(self, widget_name) print widget_name, widget if widget is None: print "ERROR: widget %s was not found" % widget_name raise Exception ("Widget %s not found" % widget_name) return widget
self.xml = gtk.glade.XML(os.path.join(glade_prefix, "progress.glade"),
self.xml = gtk.glade.XML(os.path.join(glade_prefix, "data/progress.glade"),
def __init__(self): glade_prefix = os.path.dirname(__file__)
if len(self.section) > 1: del self.section[None]
def read(self, path): f = open(path) section = self.section[None] for line in f.readlines(): line = line.strip() if line.startswith('[') and line.endswith(']'): name = line[1:-1].strip() section = self.newsection(name) self.section[name] = section continue if line.startswith('#'): continue part = line.split('=', 1) if len(part) != 2: continue name = part[0].strip() value = part[1].strip() section[name] = value if len(self.section) > 1: del self.section[None] f.close()
conn = httplib.HTTPConnection(self.host, self.ssl_port)
conn = httplib.HTTPSConnection(self.host, self.ssl_port)
def _request(self, request_type, method, info=None): handler = self.apihandler + method if self.cert_file: context = SSL.Context("sslv3") context.load_cert(self.cert_file, keyfile=self.key_file) conn = httpslib.HTTPSConnection(self.host, self.ssl_port, ssl_context=context) else: conn = httplib.HTTPConnection(self.host, self.ssl_port) conn.request(request_type, handler, body=json.dumps(info), \ headers=self.headers) response = conn.getresponse() self.validateResponse(response) rinfo = response.read() if not len(rinfo): return None return json.loads(rinfo)
if not UEP:
if ConsumerIdentity.exists(): try: UEP.unBindBySerialNumber(consumer['uuid'], self.psubs_selected) log.info("This machine is now unsubscribed from Product %s " \ % self.pname_selected) except connection.RestlibException, re: log.error(re) errorWindow(constants.UNSUBSCRIBE_ERROR) except Exception, e: log.error("Unable to perform unsubscribe due to the following exception \n Error: %s" % e) errorWindow(constants.UNSUBSCRIBE_ERROR) raise else:
def onUnsubscribeAction(self, button): global UEP if not self.psubs_selected: return log.info("Product %s selected for unsubscribe" % self.pname_selected) dlg = messageWindow.YesNoDialog(constants.CONFIRM_UNSUBSCRIBE % self.pname_selected, self.mainWin) if not dlg.getrc(): return #print self.psubs_selected if not UEP: entcerts = EntitlementDirectory().list() for cert in entcerts: if self.pname_selected == cert.getProduct().getName(): cert.delete() log.info("This machine is now unsubscribed from Product %s " % self.pname_selected) #FIXME: self.gui_reload() return try: UEP.unBindBySerialNumber(consumer['uuid'], self.psubs_selected) log.info("This machine is now unsubscribed from Product %s " \ % self.pname_selected) except connection.RestlibException, re: log.error(re) errorWindow(constants.UNSUBSCRIBE_ERROR) except Exception, e: # raise warning window log.error("Unable to perform unsubscribe due to the following exception \n Error: %s" % e) errorWindow(constants.UNSUBSCRIBE_ERROR) raise # Force fetch all certs if not fetch_certificates(): return self.gui_reload()
try: UEP.unBindBySerialNumber(consumer['uuid'], self.psubs_selected) log.info("This machine is now unsubscribed from Product %s " \ % self.pname_selected) except connection.RestlibException, re: log.error(re) errorWindow(constants.UNSUBSCRIBE_ERROR) except Exception, e: log.error("Unable to perform unsubscribe due to the following exception \n Error: %s" % e) errorWindow(constants.UNSUBSCRIBE_ERROR) raise
def onUnsubscribeAction(self, button): global UEP if not self.psubs_selected: return log.info("Product %s selected for unsubscribe" % self.pname_selected) dlg = messageWindow.YesNoDialog(constants.CONFIRM_UNSUBSCRIBE % self.pname_selected, self.mainWin) if not dlg.getrc(): return #print self.psubs_selected if not UEP: entcerts = EntitlementDirectory().list() for cert in entcerts: if self.pname_selected == cert.getProduct().getName(): cert.delete() log.info("This machine is now unsubscribed from Product %s " % self.pname_selected) #FIXME: self.gui_reload() return try: UEP.unBindBySerialNumber(consumer['uuid'], self.psubs_selected) log.info("This machine is now unsubscribed from Product %s " \ % self.pname_selected) except connection.RestlibException, re: log.error(re) errorWindow(constants.UNSUBSCRIBE_ERROR) except Exception, e: # raise warning window log.error("Unable to perform unsubscribe due to the following exception \n Error: %s" % e) errorWindow(constants.UNSUBSCRIBE_ERROR) raise # Force fetch all certs if not fetch_certificates(): return self.gui_reload()
help="name of the consuemr to create. Defaults to the username.")
help="name of the consumer to create. Defaults to the username.")
def __init__(self): usage = "usage: %prog register [OPTIONS]" shortdesc = "register the client to a Unified Entitlement Platform." desc = "register"
date = managerlib.formatDate(value) gtk.CellRendererText.set_property(self, 'text', date.strftime("%x"))
if value: date = managerlib.formatDate(value).strftime("%x") else: date = value gtk.CellRendererText.set_property(self, 'text', date)
def do_set_property(self, property, value): """ called to set the date property for rendering in a cell. we convert to display in the user's locale, then pass on to the cell renderer. """
col.set_sort_order(gtk.SORT_ASCENDING)
col.set_spacing(6) cell.set_fixed_size(-1, 35)
def populateProductDialog(self): self.tv_products = self.subsxml.get_widget("treeview_updates") self.productList = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.warn_count = 0 for product in managerlib.getInstalledProductStatus(): if product[1] in ["Expired", "Not Subscribed"]: self.warn_count += 1 self.status_icon = self.tv_products.render_icon(gtk.STOCK_DIALOG_QUESTION, size=gtk.ICON_SIZE_MENU) else: self.status_icon = self.tv_products.render_icon(gtk.STOCK_APPLY, size=gtk.ICON_SIZE_MENU) self.productList.append((self.status_icon, product[0], product[1], product[2])) self.tv_products.set_model(self.productList)
col.set_sort_order(gtk.SORT_ASCENDING)
col.set_spacing(6)
def populateProductDialog(self): self.tv_products = self.subsxml.get_widget("treeview_updates") self.productList = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.warn_count = 0 for product in managerlib.getInstalledProductStatus(): if product[1] in ["Expired", "Not Subscribed"]: self.warn_count += 1 self.status_icon = self.tv_products.render_icon(gtk.STOCK_DIALOG_QUESTION, size=gtk.ICON_SIZE_MENU) else: self.status_icon = self.tv_products.render_icon(gtk.STOCK_APPLY, size=gtk.ICON_SIZE_MENU) self.productList.append((self.status_icon, product[0], product[1], product[2])) self.tv_products.set_model(self.productList)
self.cp.unregisterConsumer(consumerid) log.info("--force specified. Successfully Unsubscribed the old consumer.")
try: self.cp.unregisterConsumer(consumerid) log.info("--force specified. Successfully Unsubscribed the old consumer.") except: log.error("Unable to unregister with consumer %s" % consumerid)
def _do_command(self): """ Executes the command. """ self._validate_options()
self.__mkdir() f = open(self.keypath())
f = open(cls.keypath())
def read(cls): self.__mkdir() f = open(self.keypath()) key = f.read() f.close() f = open(self.certpath()) cert = f.read() f.close() return ConsumerIdentity(key, cert)
f = open(self.certpath())
f = open(cls.certpath())
def read(cls): self.__mkdir() f = open(self.keypath()) key = f.read() f.close() f = open(self.certpath()) cert = f.read() f.close() return ConsumerIdentity(key, cert)
return datetime(d.year, d.month, d.day)
return datetime(d.year, d.month, d.day, tzinfo=certificate.GMT())
def _get_noncompliant_date(self): """ Returns a datetime object for the non-compliant date to use based on current state of the GUI controls. """ if self.first_noncompliant_radiobutton.get_active(): return self.last_compliant_date else: # Need to convert to a datetime: d = self.date_picker.date return datetime(d.year, d.month, d.day)
for e in self.getEntitlements(): s.append(str(e)) s.append('')
def __str__(self): s = [] s.append(Certificate.__str__(self)) s.append(str(self.getProduct())) s.append('') for e in self.getEntitlements(): s.append(str(e)) s.append('') return '\n'.join(s)
raise
def onSubscribeAction(self, button): slabel = rhsm_xml.get_widget("label_status1") #consumer = get_consumer() subscribed_count = 0 #my_model = self.tv_products.get_model() #my_model = self.other_tv.get_model() my_model = self.match_tv.get_model() pwin = progress.Progress() pwin.setLabel(_("Performing Subscribe. Please wait.")) busted_subs = [] count = 0 pwin.setProgress(count, len(self.selected.items()))
LINGER = timedelta(days=0x8E94)
def __init__(self): Lock.__init__(self, self.PATH)
LINGER = timedelta(days=30)
LINGER = timedelta(days=0x8E94)
def perform(self, *serialNumbers): for sn in serialNumbers: cert = self.entdir.find(sn) if cert is None: continue cert.delete() return self
return ( dt.utcnow() < graceperoid )
return ( gmt < graceperoid )
def mayLinger(self, cert): valid = cert.validRange() end = valid.end() graceperoid = end+self.LINGER return ( dt.utcnow() < graceperoid )
consumer = self.cp.getConsumer(self.options.consumerid, self.options.username, self.options.password)
admin_cp = connection.UEPConnection(username=self.options.username, password=self.options.password) consumer = admin_cp.getConsumer(self.options.consumerid, self.options.username, self.options.password)
def _do_command(self):
f.write(bundle['key']) f.close() cert = ProductCertificate(bundle['certificate'])
f.write(keypem) f.close() cert = ProductCertificate(crtpem)
def __write(self, bundle): path = self.entdir.keypath() f = open(path, 'w') f.write(bundle['key']) f.close() cert = ProductCertificate(bundle['certificate']) product = cert.getProduct() path = self.entdir.productpath() fn = self.__ufn(path, product) path = os.path.join(path, fn) f = open(path) f.write(bundle.cert) f.close()
f = open(path) f.write(bundle.cert)
f = open(path, 'w') f.write(crtpem)
def __write(self, bundle): path = self.entdir.keypath() f = open(path, 'w') f.write(bundle['key']) f.close() cert = ProductCertificate(bundle['certificate']) product = cert.getProduct() path = self.entdir.productpath() fn = self.__ufn(path, product) path = os.path.join(path, fn) f = open(path) f.write(bundle.cert) f.close()
d['status'] = 'VALID'
d['status'] = 'NEW' d['certificate'] = \ {'key':open('/home/jortel/x509/client.key').read(), 'certificate':open('/home/jortel/x509/client.pem').read()}
def syncCertificates(self, serialnumbers): reply = [] for sn in serialnumbers: d = {} d['serialNumber'] = sn d['status'] = 'VALID' reply.append(d) return reply
pc = ProductCertificate(content)
pc = EntitlementCertificate(content)
def write(self, path): f = open(path, 'w') f.write(self.join()) f.close() return self
print "gh", treeview, subscriptions, toggle_callback
def createSubscriptionsTreeview(self, treeview, subscriptions, toggle_callback): """ populate subscriptions compatible with your system facts """ treeview.set_model(subscriptions)
return os.path.join(cls.ROOT, path[1:]
return os.path.join(cls.ROOT, path[1:])
def abs(cls, path): if os.path.isabs(path): return os.path.join(cls.ROOT, path[1:] else: return os.path.join(cls.ROOT, path)
self.fact_cache = "/var/lib/rhsm/facts/facts.json"
self.fact_cache_dir = "/var/lib/rhsm/facts" self.fact_cache = self.fact_cache_dir + "/facts.json"
def __init__(self): self.facts = {} self.fact_cache = "/var/lib/rhsm/facts/facts.json"
print e
print "Unable to read %s" % path
def read(self, path="/var/lib/rhsm/facts/facts.json"): cached_facts = {} try: f = open(path) json_buffer = f.read() cached_facts = json.loads(json_buffer) except IOError, e: print e
entitled_data = UEP.bindByProduct(consumer['uuid'], product)['entitlement']['pool']
ent_ret = UEP.bindByProduct(consumer['uuid'], product) entitled_data = ent_ret[0]['entitlement']['pool']
def onSubscribeAction(self, button): slabel = self.addxml.get_widget("label_status") #consumer = get_consumer() subscribed_count = 0 my_model = self.tv_products.get_model() busted_subs = [] for product, state in self.selected.items(): # state = (bool, iter) if state[0]: try: entitled_data = UEP.bindByProduct(consumer['uuid'], product)['entitlement']['pool'] updated_count = str(int(entitled_data['quantity']) - int(entitled_data['consumed'])) my_model.set_value(state[-1], 3, updated_count) subscribed_count+=1 except Exception, e: # Subscription failed, continue with rest log.error("Failed to subscribe to product %s Error: %s" % (product, e)) busted_subs.append(product) continue if len(busted_subs): errorWindow(_("<b>Unable to subscribe to product(s) %s</b>\n\nPlease see /var/log/rhsm/rhsm.log for more information." % ', '.join(busted_subs[:]))) # Force fetch all certs certlib.update() if len(self.selected.items()): slabel.set_label(_("<i><b>Successfully consumed %s subscription(s)</b></i>" % subscribed_count)) elif not len(subscribed_count): slabel.set_label(_("<i><b>No subscription(s) consumed</b></i>" % subscribed_count)) else: slabel.set_label(_("<i><b>Please select atleast one subscription to apply</b></i>")) # refresh main window reload()
elif not len(subscribed_count): slabel.set_label(_("<i><b>No subscription(s) consumed</b></i>" % subscribed_count))
reload()
def onSubscribeAction(self, button): slabel = self.addxml.get_widget("label_status") #consumer = get_consumer() subscribed_count = 0 my_model = self.tv_products.get_model() busted_subs = [] for product, state in self.selected.items(): # state = (bool, iter) if state[0]: try: entitled_data = UEP.bindByProduct(consumer['uuid'], product)['entitlement']['pool'] updated_count = str(int(entitled_data['quantity']) - int(entitled_data['consumed'])) my_model.set_value(state[-1], 3, updated_count) subscribed_count+=1 except Exception, e: # Subscription failed, continue with rest log.error("Failed to subscribe to product %s Error: %s" % (product, e)) busted_subs.append(product) continue if len(busted_subs): errorWindow(_("<b>Unable to subscribe to product(s) %s</b>\n\nPlease see /var/log/rhsm/rhsm.log for more information." % ', '.join(busted_subs[:]))) # Force fetch all certs certlib.update() if len(self.selected.items()): slabel.set_label(_("<i><b>Successfully consumed %s subscription(s)</b></i>" % subscribed_count)) elif not len(subscribed_count): slabel.set_label(_("<i><b>No subscription(s) consumed</b></i>" % subscribed_count)) else: slabel.set_label(_("<i><b>Please select atleast one subscription to apply</b></i>")) # refresh main window reload()
reload()
def onSubscribeAction(self, button): slabel = self.addxml.get_widget("label_status") #consumer = get_consumer() subscribed_count = 0 my_model = self.tv_products.get_model() busted_subs = [] for product, state in self.selected.items(): # state = (bool, iter) if state[0]: try: entitled_data = UEP.bindByProduct(consumer['uuid'], product)['entitlement']['pool'] updated_count = str(int(entitled_data['quantity']) - int(entitled_data['consumed'])) my_model.set_value(state[-1], 3, updated_count) subscribed_count+=1 except Exception, e: # Subscription failed, continue with rest log.error("Failed to subscribe to product %s Error: %s" % (product, e)) busted_subs.append(product) continue if len(busted_subs): errorWindow(_("<b>Unable to subscribe to product(s) %s</b>\n\nPlease see /var/log/rhsm/rhsm.log for more information." % ', '.join(busted_subs[:]))) # Force fetch all certs certlib.update() if len(self.selected.items()): slabel.set_label(_("<i><b>Successfully consumed %s subscription(s)</b></i>" % subscribed_count)) elif not len(subscribed_count): slabel.set_label(_("<i><b>No subscription(s) consumed</b></i>" % subscribed_count)) else: slabel.set_label(_("<i><b>Please select atleast one subscription to apply</b></i>")) # refresh main window reload()
print "main done"
def main(): global gui signal.signal(signal.SIGINT, signal.SIG_DFL) if os.geteuid() != 0 : #rootWarning() sys.exit(1) gui = ManageSubscriptionPage() gtk.main() print "main done"
self.sumlabel.set_label(_("<b>%s products or subscriptions need your attention.\n</b>Add or Update subscriptions for products you are using.\n" % self.warn_count))
self.sumlabel.set_label(_("<b>%s products or subscriptions need your attention.\n\n</b>Add or Update subscriptions for products you are using.\n" % self.warn_count))
def updateMessage(self): self.sumlabel = self.subsxml.get_widget("summaryLabel1") if self.warn_count: self.sumlabel.set_label(_("<b>%s products or subscriptions need your attention.\n</b>Add or Update subscriptions for products you are using.\n" % self.warn_count)) else: self.sumlabel.set_label(_("Add or Update subscriptions for products you are using."))
col.set_spacing(4)
def populateAvailableList(self): consumer = managerlib.check_registration() self.availableList = gtk.TreeStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) for product in managerlib.getAvailableEntitlements(UEP, consumer): self.availableList.append(None, [False] + product.values()) self.tv_products = self.addxml.get_widget("treeview_available") self.tv_products.set_model(self.availableList)
for pname, phash in managerlib.getUnstalledProductHashMap().items():
for pname, phash in managerlib.getInstalledProductHashMap().items():
def _do_command(self): """ Executes the command. """ self._validate_options()
self.cp.bindByProduct(consumer['uuid'], phash)
def _do_command(self): """ Executes the command. """ self._validate_options()
s.append('\tArchitecture = %s' % self.getArchitecture())
s.append('\tArchitecture = %s' % self.getArch())
def __str__(self): s = [] s.append('Product {') s.append('\tName = %s' % self.getName()) s.append('\tDescription = %s' % self.getDescription()) s.append('\tArchitecture = %s' % self.getArchitecture()) s.append('\tVersion = %s' % self.getVersion()) s.append('\tQuantity = %s' % self.getQuantity()) s.append('\tSubtype = %s' % self.getSubtype()) s.append('\tVirtualization Limit = %s' % self.getVirtualizationLimit()) s.append('\tSocket Limit = %s' % self.getSocketLimit()) s.append('\tProduct Code = %s' % self.getProductOptionCode()) s.append('}') return '\n'.join(s)
s.append('\tVirtualization Limit = %s' % self.getVirtualizationLimit())
s.append('\tVirtualization Limit = %s' % self.getVirtLimit())
def __str__(self): s = [] s.append('Product {') s.append('\tName = %s' % self.getName()) s.append('\tDescription = %s' % self.getDescription()) s.append('\tArchitecture = %s' % self.getArchitecture()) s.append('\tVersion = %s' % self.getVersion()) s.append('\tQuantity = %s' % self.getQuantity()) s.append('\tSubtype = %s' % self.getSubtype()) s.append('\tVirtualization Limit = %s' % self.getVirtualizationLimit()) s.append('\tSocket Limit = %s' % self.getSocketLimit()) s.append('\tProduct Code = %s' % self.getProductOptionCode()) s.append('}') return '\n'.join(s)
s.append('\tArchitecture = %s' % self.getArchitecture())
s.append('\tArchitecture = %s' % self.getArch())
def __str__(self): s = [] s.append('Entitlement {') s.append('\tName = %s' % self.getName()) s.append('\tDescription = %s' % self.getDescription()) s.append('\tArchitecture = %s' % self.getArchitecture()) s.append('\tVersion = %s' % self.getVersion()) s.append('\tGuest Quantity = %s' % self.getGuestQuantity()) s.append('\tQuantity = %s' % self.getQuantity()) s.append('\tUpdates Allowd = %s' % self.getUpdatesAllowd()) s.append('\tVendor = %s' % self.getVendor()) s.append('\tURL = %s' % self.getUrl()) s.append('}') return '\n'.join(s)
proxy_user=self.options.proxy_user, proxy_password=self.options.proxy_password)
proxy_user=self.proxy_user, proxy_password=self.proxy_password)
def _do_command(self):
proxy_user=self.options.proxy_user, proxy_password=self.options.proxy_password)
proxy_user=self.proxy_user, proxy_password=self.proxy_password)
def _do_command(self): """ Executes the command. """ self._validate_options()
for valid in self.entdir.listValid():
for valid in self.entdir.listValid(grace_period=True):
def getLocal(self, report): local = {} for valid in self.entdir.listValid(): sn = valid.serialNumber() report.valid.append(sn) local[sn] = valid return local
except:
except Exception, e:
def onSubscribeAction(self, button): slabel = self.addxml.get_widget("label_status") #consumer = get_consumer() subscribed_count = 0 my_model = self.tv_products.get_model() for product, state in self.selected.items(): # state = (bool, iter) if state[0]: try: entitled_data = UEP.bindByProduct(consumer['uuid'], product)['entitlement']['pool'] updated_count = str(int(entitled_data['quantity']) - int(entitled_data['consumed'])) my_model.set_value(state[-1], 3, updated_count) subscribed_count+=1 except: # Subscription failed, continue with rest log.error("Failed to subscribe to product %s" % product) errorWindow("Failed to subscribe to product %s" % product) continue # Force fetch all certs certlib.update() if len(self.selected.items()): slabel.set_label(_("<i><b>Successfully consumed %s subscription(s)</b></i>" % subscribed_count)) else: slabel.set_label(_("<i><b>Please select atleast one subscription to apply</b></i>"))
log.error("Failed to subscribe to product %s" % product) errorWindow("Failed to subscribe to product %s" % product)
log.error("Failed to subscribe to product %s Error: %s" % (product, e)) busted_subs.append(product)
def onSubscribeAction(self, button): slabel = self.addxml.get_widget("label_status") #consumer = get_consumer() subscribed_count = 0 my_model = self.tv_products.get_model() for product, state in self.selected.items(): # state = (bool, iter) if state[0]: try: entitled_data = UEP.bindByProduct(consumer['uuid'], product)['entitlement']['pool'] updated_count = str(int(entitled_data['quantity']) - int(entitled_data['consumed'])) my_model.set_value(state[-1], 3, updated_count) subscribed_count+=1 except: # Subscription failed, continue with rest log.error("Failed to subscribe to product %s" % product) errorWindow("Failed to subscribe to product %s" % product) continue # Force fetch all certs certlib.update() if len(self.selected.items()): slabel.set_label(_("<i><b>Successfully consumed %s subscription(s)</b></i>" % subscribed_count)) else: slabel.set_label(_("<i><b>Please select atleast one subscription to apply</b></i>"))
pattern = re.compile('([0-9]+\.)+[0-9]:')
pattern = re.compile('([0-9]+\.)+[0-9]+:')
def dst(self, dt): return 0
def getRegnum(self):
def getSubscription(self):
def getRegnum(self): return self.ext.get('4')
s.append('\tName ...... = %s' % self.getName()) s.append('\tNumber .... = %s' % self.getNumber()) s.append('\tSKU ....... = %s' % self.getSku()) s.append('\tRegnum .... = %s' % self.getRegnum()) s.append('\tQuantity .. = %s' % self.getQuantity())
s.append('\tName .......... = %s' % self.getName()) s.append('\tNumber ........ = %s' % self.getNumber()) s.append('\tSKU ........... = %s' % self.getSku()) s.append('\tSubscription .. = %s' % self.getSubscription()) s.append('\tQuantity ...... = %s' % self.getQuantity()) s.append('\tStart (Ent) ... = %s' % self.getStart()) s.append('\tEnd (Ent) ..... = %s' % self.getEnd()) s.append('\tSubtype ....... = %s' % self.getSubtype()) s.append('\tVirt Limit .... = %s' % self.getVirtLimit()) s.append('\tSocket Limit .. = %s' % self.getSocketLimit()) s.append('\tOption Code ... = %s' % self.getOptionCode()) s.append('\tContract ...... = %s' % self.getContract())
def __str__(self): s = [] s.append('Order {') s.append('\tName ...... = %s' % self.getName()) s.append('\tNumber .... = %s' % self.getNumber()) s.append('\tSKU ....... = %s' % self.getSku()) s.append('\tRegnum .... = %s' % self.getRegnum()) s.append('\tQuantity .. = %s' % self.getQuantity()) s.append('}') return '\n'.join(s)
print constants.available_subs_list % (data['productName'],
product_name = self._format_name(data['productName'], 24, 80) print constants.available_subs_list % (product_name,
def _do_command(self): """ Executes the command. """ self._validate_options() consumer = check_registration()['uuid'] if not (self.options.available or self.options.consumed): iproducts = managerlib.getInstalledProductStatus() if not len(iproducts): print("No installed Products to list") sys.exit(0) print """+-------------------------------------------+\n Installed Product Status\n+-------------------------------------------+""" for product in iproducts: print constants.installed_product_status % product
sys.exit(1)
sys.exit(0)
def main(self): if len(sys.argv) < 2 or not self._find_best_match(sys.argv): self._usage() sys.exit(1)
self._show_add_sub_button()
self._show_unregister_button() self._show_add_sub_button()
def _show_buttons(self): """ Renders the Tools buttons dynamically. """ log.debug("Showing buttons.") self.button_bar.foreach(lambda widget: self.button_bar.remove(widget)) registered = self.registered() if not registered: self._show_register_button() else: self._show_add_sub_button()
if registered: self._show_unregister_button()
def _show_buttons(self): """ Renders the Tools buttons dynamically. """ log.debug("Showing buttons.") self.button_bar.foreach(lambda widget: self.button_bar.remove(widget)) registered = self.registered() if not registered: self._show_register_button() else: self._show_add_sub_button()
method = "%s?listall=true" % method
method = "%s&listall=true" % method
def getPoolsList(self, consumerId, listAll=False): method = "/pools?consumer=%s" % consumerId if listAll: method = "%s?listall=true" % method results = self.conn.request_get(method) return results
UpdateSubscriptionScreen(self.pname_selected)
if self.pname_selected: UpdateSubscriptionScreen(self.pname_selected)
def updateSubButtonAction(self, button): UpdateSubscriptionScreen(self.pname_selected)
"on_contract_selection_treeview_cursor_changed": \ self._cursor_changed,
def __init__(self, selected_callback, cancel_callback): self._selected_callback = selected_callback self._cancel_callback = cancel_callback self.total_contracts = 0 self.contract_selection_xml = gtk.glade.XML(CONTRACT_SELECTION_GLADE) self.contract_selection_win = self.contract_selection_xml.get_widget( "contract_selection_window")
def _cursor_changed(self, treeview): print "cursor" selected_row = self.model[treeview.get_cursor()[0][0]] print selected_row def main(): pool1 = { 'productId': 'asdfsa', 'productName': 'foobar', 'consumed': '5', 'quantity': '10', 'startDate': '1232', 'endDate': '12312', } pool2 = { 'productId': 'asdfsa2', 'productName': 'foobar2', 'consumed': '5', 'quantity': '15', 'startDate': '21232', 'endDate': '212312', } win = ContractSelectionWindow() win.add_pool(pool1) win.add_pool(pool1) win.show() gtk.main() if __name__ == "__main__": main()
def _subscribe_button_clicked(self, button): self._selected_callback( self.model[self.contract_selection_treeview.get_cursor()[0][0]][5])
return self.date_picker.date
d = self.date_picker.date return datetime(d.year, d.month, d.day)
def _get_noncompliant_date(self): """ Returns a datetime object for the non-compliant date to use based on current state of the GUI controls. """ if self.first_noncompliant_radiobutton.get_active(): return self.last_compliant_date else: return self.date_picker.date
on_date=self.last_compliant_date)
on_date=self._get_noncompliant_date())
def _display_uncompliant(self): sorter = CertSorter(self.product_dir, self.entitlement_dir, on_date=self.last_compliant_date)
self.compliance_label.set_label(_("All software is in compliance until %s.") % self.last_compliant_date.strftime(locale.nl_langinfo(locale.D_FMT))) self.compliant_today_label.set_label(_("%s (First date of non-compliance)") % self.last_compliant_date.strftime(locale.nl_langinfo(locale.D_FMT)))
if self.last_compliant_date: formatted = self.last_compliant_date.strftime(locale.nl_langinfo(locale.D_FMT)) self.compliance_label.set_label( _("All software is in compliance until %s.") % formatted) self.compliant_today_label.set_label( _("%s (First date of non-compliance)") % formatted)
def __init__(self, backend, consumer, facts): self.backend = backend self.consumer = consumer self.facts = facts self.pool_stash = managerlib.PoolStash(self.backend, self.consumer, self.facts)
self.compat = []
def populateSubscriptionLists(self): try: compatible = managerlib.getAvailableEntitlements(UEP, self.consumer.uuid, self.facts) pool_filter = managerlib.PoolFilter() self.matched = pool_filter.filter_uninstalled(compatible) matched_pids = [] for product in self.matched: pdata = [product['productName'], product['quantity'], product['endDate'], product['id']] self.matchedList.append(None, [False] + pdata) matched_pids.append(product['productId']) self.available_ent += 1
if not consumername: consumername = None
if not self.validate_consumername(consumername): return False
def register(self, testing=None): self.uname = registration_xml.get_widget("account_login") self.passwd = registration_xml.get_widget("account_password") self.consumer_name = registration_xml.get_widget("consumer_name")
self._do_command()
try: self._do_command() except X509.X509Error, e: log.error(e) print 'Consumer certificates corrupted. Please re-register'
def main(self):
return self.finish()
return self.close_window()
def delete_event(self, event, data=None): return self.finish()
print 'subscribe window hiding'
def cancel(self, button): self.addWin.hide() print 'subscribe window hiding'
print "onSubscribeAction" print logutil.trace_me()
def onSubscribeAction(self, button): print "onSubscribeAction" print logutil.trace_me() slabel = rhsm_xml.get_widget("label_status1") #consumer = get_consumer() subscribed_count = 0 #my_model = self.tv_products.get_model() #my_model = self.other_tv.get_model() my_model = self.match_tv.get_model() pwin = progress.Progress() pwin.setLabel(_("Performing Subscribe. Please wait.")) busted_subs = [] count = 0 pwin.setProgress(count, len(self.selected.items()))
print "Restlib.init" print "cert_file", cert_file
def __init__(self, host, ssl_port, apihandler, cert_file=None, key_file=None, ca_file=None, insecure=False): print "Restlib.init" print "cert_file", cert_file self.host = host self.ssl_port = ssl_port self.apihandler = apihandler self.headers = {"Content-type":"application/json", "Accept": "application/json", "Accept-Language": locale.getdefaultlocale()[0].lower().replace('_', '-')} self.cert_file = cert_file self.key_file = key_file self.ca_file = ca_file self.insecure = insecure
print "gh100"
def _request(self, request_type, method, info=None): handler = self.apihandler + method context = SSL.Context("sslv3") if self.ca_file != None: log.info('loading ca_file located at: %s', self.ca_file) context.load_verify_locations(self.ca_file) log.info('work in insecure mode ?:%s', self.insecure) if not self.insecure: #allow clients to work insecure mode if required.. context.set_verify(SSL.verify_fail_if_no_peer_cert, 1) if self.cert_file: context.load_cert(self.cert_file, keyfile=self.key_file) conn = httpslib.HTTPSConnection(self.host, self.ssl_port, ssl_context=context) else: print "gh100" conn = httpslib.HTTPSConnection(self.host, self.ssl_port, ssl_context=context) conn.request(request_type, handler, body=json.dumps(info), \ headers=self.headers) response = conn.getresponse() result = { "content": response.read(), "status" : response.status } #TODO: change logging to debug. log.info('response:' + str(result['content'])) log.info('status code: ' + str(result['status'])) self.validateResponse(result) if not len(result['content']): return None return json.loads(result['content'])
print "init UEP" print "self.conn", self.conn print "self.cert_file", self.cert_file print "self.candlepin_ca_file", self.candlepin_ca_file print "self.key_file", self.key_file
def __init__(self, host='localhost', ssl_port=8443, handler="/candlepin", cert_file=None, key_file=None): self.host = host self.ssl_port = ssl_port self.handler = handler self.conn = None self.basic_auth_conn = None self.cert_file = cert_file self.key_file = key_file config = initConfig() self.candlepin_ca_file = config['candlepin_ca_file'] config_insecure = config['insecure_mode'] self.insecure = False if config_insecure in ['True', 'true', 't', 1]: self.insecure = True if self.candlepin_ca_file == None: log.info("Value \'candlepin_ca_file\' not present in config file. Assuming default value: %s", DEFAULT_CA_FILE) self.candlepin_ca_file = DEFAULT_CA_FILE # initialize connection self.conn = Restlib(self.host, self.ssl_port, self.handler, self.cert_file, self.key_file, self.candlepin_ca_file, self.insecure) log.info("Connection Established: host: %s, port: %s, handler: %s" % (self.host, self.ssl_port, self.handler)) print "init UEP" print "self.conn", self.conn print "self.cert_file", self.cert_file print "self.candlepin_ca_file", self.candlepin_ca_file print "self.key_file", self.key_file
print method
def unBindBySerialNumber(self, consumerId, serial): method = "/consumers/%s/certificates/%s" % (consumerId, serial) print method return self.conn.request_delete(method)
print "getPoolsList" print self.conn print self.conn.cert_file
def getPoolsList(self, consumerId): method = "/pools?consumer=%s" % consumerId print "getPoolsList" print self.conn print self.conn.cert_file
return 'customer: "%s", user: "%s", consumer (uuid): %s' % \ (self.getCustomerName(), self.getUser(), self.getConsumerId())
return 'consumer: name="%s", uuid=%s, user: "%s"' % \ (self.getConsumerName(), self.getConsumerId(), self.getUser())
def __str__(self): return 'customer: "%s", user: "%s", consumer (uuid): %s' % \ (self.getCustomerName(), self.getUser(), self.getConsumerId())
col.set_spacing(6)
col.set_spacing(15)
def populateProductDialog(self): state_icon_map = {"Expired" : gtk.STOCK_DIALOG_WARNING, "Not Subscribed" : gtk.STOCK_DIALOG_QUESTION, "Subscribed" : gtk.STOCK_APPLY, } self.tv_products = self.subsxml.get_widget("treeview_updates") self.productList = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.warn_count = 0 for product in managerlib.getInstalledProductStatus(): markup_status = product[1] if product[1] in ["Expired", "Not Subscribed"]: self.warn_count += 1 markup_status = '<span foreground="red"><b>%s</b></span>' % product[1] self.status_icon = self.tv_products.render_icon(state_icon_map[product[1]], size=gtk.ICON_SIZE_MENU) self.productList.append((self.status_icon, product[0], markup_status, product[2])) self.tv_products.set_model(self.productList)
col.set_spacing(6)
def populateProductDialog(self): state_icon_map = {"Expired" : gtk.STOCK_DIALOG_WARNING, "Not Subscribed" : gtk.STOCK_DIALOG_QUESTION, "Subscribed" : gtk.STOCK_APPLY, } self.tv_products = self.subsxml.get_widget("treeview_updates") self.productList = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.warn_count = 0 for product in managerlib.getInstalledProductStatus(): markup_status = product[1] if product[1] in ["Expired", "Not Subscribed"]: self.warn_count += 1 markup_status = '<span foreground="red"><b>%s</b></span>' % product[1] self.status_icon = self.tv_products.render_icon(state_icon_map[product[1]], size=gtk.ICON_SIZE_MENU) self.productList.append((self.status_icon, product[0], markup_status, product[2])) self.tv_products.set_model(self.productList)
alabel.set_label(_("\nThis system is registered with the account <b>%s</b>\n\n<b>UID:</b> %s" % (euser, consumer['uuid'])))
alabel.set_label(_("\n<b>User Account:</b> %s" % euser)) alabel1 = self.regtokenxml.get_widget("account_label1") alabel1.set_label(_("\nThis system is registered with the account")) alabel = self.regtokenxml.get_widget("account_label2") alabel.set_label(_("<b> ConsumerID:</b> %s" % consumer["uuid"]))
def setAccountMsg(self): euser = consumer['user_account'] or None alabel = self.regtokenxml.get_widget("account_label") alabel.set_label(_("\nThis system is registered with the account <b>%s</b>\n\n<b>UID:</b> %s" % (euser, consumer['uuid'])))
self._get_widget('action_area').destroy()
self._get_widget('action_area').hide()
def createScreen(self): self.vbox = gtk.VBox(spacing=10) self._get_widget("main_vbox").reparent(self.vbox)
print "cert", c
def filter_entitlements_by_products(self, products): matched_data_dict = {} for c in self.entitlement_directory.list(): print "cert", c for product in products: productid = product.getProduct().getHash() print productid, c.getProduct().getHash() if productid == c.getProduct().getHash(): matched_data_dict[c.serialNumber()] = c return matched_data_dict
print productid, c.getProduct().getHash()
def filter_entitlements_by_products(self, products): matched_data_dict = {} for c in self.entitlement_directory.list(): print "cert", c for product in products: productid = product.getProduct().getHash() print productid, c.getProduct().getHash() if productid == c.getProduct().getHash(): matched_data_dict[c.serialNumber()] = c return matched_data_dict
print "pool", d
def filter_pools_by_products(self, pools, products): """ Filter a list of pools and return just those that have the products in the list of products and returns those pools """ matched_data_dict = {} for d in pools: print "pool", d for product in products: productid = product.getProduct().getHash() if productid == d['productId']: matched_data_dict[d['id']] = d
day = self.day.get_text()
day = self.day_entry.get_text()
def get_active_on_date(self): """ Returns a date for the "active on" field. """ year = self.year_entry.get_text() month = self.month_entry.get_text() day = self.day.get_text()
shutil.rmtree(cfg.get('rhsm', 'consumerCertDir'), ignore_errors=True) shutil.rmtree(cfg.get('rhsm', 'entitlementCertDir'), ignore_errors=True) log.info("Successfully un-registered.")
delete_consumer_certs()
def unregister(uep, consumer_uuid, force=True): """ Shared logic for un-registration. If an unregistration fails, we always clean up locally, but allow the exception to be thrown so the caller can decide how to handle it. """ try: uep.unregisterConsumer(consumer_uuid) finally: if force: # Clean up certificates, these are no longer valid: shutil.rmtree(cfg.get('rhsm', 'consumerCertDir'), ignore_errors=True) shutil.rmtree(cfg.get('rhsm', 'entitlementCertDir'), ignore_errors=True) log.info("Successfully un-registered.")
_('Covered by subscription %s through %s' % \ (order.getSubscription(), entry['expiration_date']))
_('Covered by contract %s through %s' % \ (order.getContract(), entry['expiration_date']))
def update_products(self): self.store.clear() for product_cert in self.product_dir.list(): for product in product_cert.getProducts(): product_hash = product.getHash() entitlement_cert = self.entitlement_dir.findByProduct(product_hash) entry = {} entry['product'] = product.getName() entry['version'] = product.getVersion() # Common properties entry['align'] = 0.5 if entitlement_cert: order = entitlement_cert.getOrder() entry['contract'] = order.getContract() entry['subscription'] = order.getName() entry['start_date'] = formatDate(order.getStart()) entry['expiration_date'] = formatDate(order.getEnd()) # TODO: Pull this date logic out into a separate lib! # This is also used in mysubstab... date_range = entitlement_cert.validRange() now = datetime.now(GMT()) if now < date_range.begin(): entry['status'] = _('Future Subscription') elif now > date_range.end(): entry['image'] = self._render_icon(gtk.STOCK_REMOVE) entry['status'] = _('Out of Compliance') entry['compliance_note'] = \ _('Subscription %s is expired' % order.getSubscription()) else: entry['image'] = self._render_icon(gtk.STOCK_APPLY) entry['status'] = _('In Compliance') entry['compliance_note'] = \ _('Covered by subscription %s through %s' % \ (order.getSubscription(), entry['expiration_date'])) else: entry['image'] = self._render_icon(gtk.STOCK_REMOVE) entry['status'] = _('Out of Compliance') entry['compliance_note'] = _("Never Subscribed") self.store.add_map(entry)
self.meminfo["memory."+key.lower().replace(" ", "_")] = \ "%s" % int(value)
nkey = '.'.join(["memory", key.lower()]) self.meminfo[nkey] = "%s" % int(value)
def getMemInfo(self): self.meminfo = {} try: parser = re.compile(r'^(?P<key>\S*):\s*(?P<value>\d*)\s*kB' ) memdata = open('/proc/meminfo') for info in memdata: match = parser.match(info) if not match: continue key, value = match.groups(['key', 'value']) self.meminfo["memory."+key.lower().replace(" ", "_")] = \ "%s" % int(value) except: print _("Error reading system memory information:"), sys.exc_type self.allhw.update(self.meminfo) return self.meminfo
ddict[tag+key1.lower().replace(" ", "_")] = str(value1)
nkey = ''.join([tag, key1.lower()]).replace(" ", "_") ddict[nkey] = str(value1)
def _get_dmi_data(self, func, tag, ddict): for key, value in func.items(): for key1, value1 in value['data'].items(): if not isinstance(value1, str): continue ddict[tag+key1.lower().replace(" ", "_")] = str(value1)
return path
return os.path.join(cls.ROOT, path[1:]
def abs(cls, path): if os.path.isabs(path): return path else: return os.path.join(cls.ROOT, path)
self.subscription_store = gtk.ListStore(str, str, str, str, str, str, gtk.Button)
self.subscription_store = gtk.ListStore(str, str, str, str, str, str, bool)
def __init__(self, backend, consumer): self.backend = backend self.consumer = consumer
def add_text_column(name):
def add_column(name, renderer=text_renderer):
def add_text_column(name): column_number = len(self.subscription_view.get_columns()) column = gtk.TreeViewColumn(_(name), text_renderer, text=column_number)