def parseLegacyURI(self, uristring, requestors): """Parses previous CUPS Cloud Print URIs, only used for upgrades Args: uristring: string, uri of the Cloud Print device Returns: string: account name string: google cloud print printer name string: google cloud print printer id int: format id """ formatId = None printerName = None accountName = None printerId = None uri = urlparse(uristring) pathparts = uri.path.strip('/').split('/') if uri.scheme == Utils.OLD_PROTOCOL_NAME: if len(pathparts) == 2: formatId = PrinterManager.URIFormat20140307 printerId = urllib.unquote(pathparts[1]) accountName = urllib.unquote(pathparts[0]) printerName = urllib.unquote(uri.netloc) else: if urllib.unquote( uri.netloc) not in Auth.GetAccountNames(requestors): formatId = PrinterManager.URIFormat20140210 printerName = urllib.unquote(uri.netloc) accountName = urllib.unquote(pathparts[0]) else: formatId = PrinterManager.URIFormat20140308 printerId = urllib.unquote(pathparts[0]) printerName = None accountName = urllib.unquote(uri.netloc) elif uri.scheme == Utils.PROTOCOL_NAME: formatId = PrinterManager.URIFormatLatest printerId = urllib.unquote(pathparts[0]) printerName = None accountName = urllib.unquote(uri.netloc) return accountName, printerName, printerId, formatId
def _initAccounts(self): self.window.resetAccounts() for account_name in Auth.GetAccountNames(self.window.getRequestors()): self.tree.insert('', 'end', account_name, values=(account_name, )) self.add_button.focus()