rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
host_override=options.host,
host_override=host_override,
def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password)
save_cookies=options.save_cookies)
save_cookies=save_cookies)
def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password)
return rpc_server_class(options.server, GetUserCredentials, host_override=options.host, save_cookies=options.save_cookies)
return rpc_server_class(server, GetUserCredentials, host_override=host_override, save_cookies=save_cookies)
def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password)
rpc_server = GetRpcServer(options)
rpc_server = GetRpcServer(options.server, options.email, options.host, options.save_cookies)
def RealMain(argv, data=None): """The real main function. Args: argv: Command line arguments. data: Diff contents. If None (default) the diff is generated by the VersionControlSystem implementation returned by GuessVCS(). Returns: A 2-tuple (issue id, patchset id). The patchset id is None if the base files are not up...
base = vcs.GuessBase(options.download_base) else: base = None
guessed_base = vcs.GuessBase(options.download_base) if base: if guessed_base and base != guessed_base: print "Using base URL \"%s\" from --base_url instead of \"%s\"" % \ (base, guessed_base) else: base = guessed_base
def RealMain(argv, data=None): """The real main function. Args: argv: Command line arguments. data: Diff contents. If None (default) the diff is generated by the VersionControlSystem implementation returned by GuessVCS(). Returns: A 2-tuple (issue id, patchset id). The patchset id is None if the base files are not up...
nm = '_%s__FacetMap' % (cls.__name__.strip('_'),)
nm = '_%s__FacetMap' % (nm,)
def __FacetMapAttributeName (cls): """ """ ''' if cls == simpleTypeDefinition: return '_%s__FacetMap' % (cls.__name__.strip('_'),)
nm = '_' + utility.MakeIdentifier('%s_%s_FacetMap' % (ns_uri, cls.__name__.strip('_')))
nm = '_' + utility.MakeIdentifier('%s_%s_FacetMap' % (ns_uri, nm))
def __FacetMapAttributeName (cls): """ """ ''' if cls == simpleTypeDefinition: return '_%s__FacetMap' % (cls.__name__.strip('_'),)
print 'AS.CTOR %s: %d choices' % (self, len(self.__choices))
def __init__ (self, group, parent_particle_state): self.__parentParticleState = parent_particle_state super(AllState, self).__init__(group) self.__choices = set([ ParticleState(_p, self) for _p in group.particles() ]) print 'AS.CTOR %s: %d choices' % (self, len(self.__choices))
print 'AS.ACC %s %s: %s %s %s' % (self, self.__activeChoice, instance, value, element_use)
def accepts (self, particle_state, instance, value, element_use): print 'AS.ACC %s %s: %s %s %s' % (self, self.__activeChoice, instance, value, element_use) self.__needRetry = True while self.__needRetry: self.__needRetry = False if self.__activeChoice is None: for choice in self.__choices: print 'AS.ACC %s candidate %...
print 'AS.ACC %s candidate %s' % (self, choice)
def accepts (self, particle_state, instance, value, element_use): print 'AS.ACC %s %s: %s %s %s' % (self, self.__activeChoice, instance, value, element_use) self.__needRetry = True while self.__needRetry: self.__needRetry = False if self.__activeChoice is None: for choice in self.__choices: print 'AS.ACC %s candidate %...
print 'AS.ACC %s: candidate %s : %s' % (self, choice, consume)
def accepts (self, particle_state, instance, value, element_use): print 'AS.ACC %s %s: %s %s %s' % (self, self.__activeChoice, instance, value, element_use) self.__needRetry = True while self.__needRetry: self.__needRetry = False if self.__activeChoice is None: for choice in self.__choices: print 'AS.ACC %s candidate %...
print 'AS.ACC %s : active choice %s %s %s' % (self, self.__activeChoice, consume, underflow_exc)
def accepts (self, particle_state, instance, value, element_use): print 'AS.ACC %s %s: %s %s %s' % (self, self.__activeChoice, instance, value, element_use) self.__needRetry = True while self.__needRetry: self.__needRetry = False if self.__activeChoice is None: for choice in self.__choices: print 'AS.ACC %s candidate %...
print 'AS.VC %s: %s' % (self, self.__activeChoice)
def _verifyComplete (self, parent_particle_state): print 'AS.VC %s: %s' % (self, self.__activeChoice) if self.__activeChoice is not None: self.__activeChoice.verifyComplete() for choice in self.__choices: choice.verifyComplete()
for choice in self.__choices: choice.verifyComplete()
while self.__choices: self.__activeChoice = self.__choices.pop() self.__activeChoice.verifyComplete()
def _verifyComplete (self, parent_particle_state): print 'AS.VC %s: %s' % (self, self.__activeChoice) if self.__activeChoice is not None: self.__activeChoice.verifyComplete() for choice in self.__choices: choice.verifyComplete()
print 'AS.NF %s %s' % (self, particle_ok)
def notifyFailure (self, sub_state, particle_ok): print 'AS.NF %s %s' % (self, particle_ok) self.__needRetry = True self.__activeChoice = None if particle_ok and (0 == len(self.__choices)): self.__parentParticleState.incrementCount()
if element_use is not None: print 'WARNING: Non-null EU does not match' return False assert not isinstance(value, xml.dom.Node) try: self.setOrAppend(ctd, self.__elementBinding.compatibleValue(value, _convert_string_values=False)) return True except pyxb.BadTypeValueError, e: pass print '%s %s %s in %s' % (ctd, value, ...
def accepts (self, state_stack, ctd, value, element_use): if element_use == self: self.setOrAppend(ctd, value) return True #print '%s %s %s in %s' % (ctd, value, element_use, self) return False
else: if self.__count < self.__particle.minOccurs(): raise pyxb.MissingContentError(self.__particle)
def accepts (self, state_stack, ctd, value, element_use): match = self.__particle.term().accepts(state_stack, ctd, value, element_use) #print 'CHECK %s %s on %s for %s' % (self, match, value, element_use) if match: self.__count += 1 if self.__particle.isOverLimit(self.__count): raise pyxb.UnexpectedContentError(value) ...
if self.__particleIndex > len(self.__particles):
if self.__particleIndex >= len(self.__particles):
def accepts (self, state_stack, ctd, value, element_use): if self.__particleIndex > len(self.__particles): return False particle = self.__particles[self.__particleIndex] self.__particleIndex += 1 state_stack.pushModelState(ParticleState(particle)) return state_stack.step(ctd, value, element_use)
raise MissingContentError('choice')
raise pyxb.MissingContentError('choice')
def _verifyComplete (self, parent_particle_state): rv = True if self.__activeChoice is None: for choice in self.__choices: try: choice.verifyComplete() return except Exception, e: pass raise MissingContentError('choice') self.__activeChoice.verifyComplete() parent_particle_state.incrementCount()
parent_particle_state.incrementCount()
def _verifyComplete (self, parent_particle_state): rv = True if self.__activeChoice is None: for choice in self.__choices: try: choice.verifyComplete() return except Exception, e: pass raise MissingContentError('choice') self.__activeChoice.verifyComplete() parent_particle_state.incrementCount()
while self.meetsMaximum(count) and self.__term._validate(symbol_set, output_sequence):
while (count != self.__maxOccurs) and self.__term._validate(symbol_set, output_sequence):
def _validate (self, symbol_set, output_sequence): count = 0 #print 'Validate %d %s PRT %s' % (self.__minOccurs, self.__maxOccurs, self.__term) last_size = len(output_sequence) while self.meetsMaximum(count) and self.__term._validate(symbol_set, output_sequence): #print 'PRT validated, cnt %d, left %s' % (count, symbol...
result = self.meetsMinimum(count) and self.meetsMaximum(count)
result = self.satisfiesOccurrences(count)
def _validate (self, symbol_set, output_sequence): count = 0 #print 'Validate %d %s PRT %s' % (self.__minOccurs, self.__maxOccurs, self.__term) last_size = len(output_sequence) while self.meetsMaximum(count) and self.__term._validate(symbol_set, output_sequence): #print 'PRT validated, cnt %d, left %s' % (count, symbol...
description = sqlobject.StringCol()
description = sqlobject.UnicodeCol()
def toggle_hide(self): """ Toggle if this context is display in the main view. """ self.hide = not self.hide
description = sqlobject.StringCol()
description = sqlobject.UnicodeCol()
def toggle(self): """ Toggle to todo completion state. """ self.completed = not self.completed self.completed_at = datetime.now() if self.completed else None
print todo_id, self.previous_todo
def wait_for(self, todo_id): """ Define the todo that this item will wait to be completed to appears in list_items or the main_view.
for item in self.diplayed_hlayouts: self.diplayed_hlayouts[item].hide() del self.diplayed_hlayouts[item]
for item in self.diplayed_hlayouts.values(): item.hide() del item
def hide(self): if len(self.diplayed_hlayouts): for item in self.diplayed_hlayouts: self.diplayed_hlayouts[item].hide() del self.diplayed_hlayouts[item]
layout.addWidget(self.resize_label)
add_to_layout(layout, self.resize_label)
def create_device_resize_layout(_self): layout = QtGui.QVBoxLayout() self.resize_label = QtGui.QLabel(_("Partition sizes :<br>You can use the following default values " "or you can resize the partition sizes to meet your needs :<br><br>")) self.resize_label.setWordWrap(True) self.resize_label.setEnabled(False) layout.a...
layout.addWidget(splitter)
add_to_layout(layout, splitter)
def create_device_resize_layout(_self): layout = QtGui.QVBoxLayout() self.resize_label = QtGui.QLabel(_("Partition sizes :<br>You can use the following default values " "or you can resize the partition sizes to meet your needs :<br><br>")) self.resize_label.setWordWrap(True) self.resize_label.setEnabled(False) layout.a...
gettext.install('vlaunch', localedir=path.join(DATA_DIR, "locale"), unicode=True)
def make_path(base, value): if value: return path.normpath(path.join(base,path.expanduser(value))) else: return ""
"Be aware to disable debug mode at end of the debug session"),
"Be aware to disable debug mode at end of the debug session."),
def configure_virtual_machine(self, create_vmdk = True): if not conf.VMDK and not conf.CONFIGUREVM: logging.debug("Skipping configuration of the VM") self.vbox.close_session() return
self.backup = QtGui.QRadioButton(_("Backup my %s device") % PRODUCTNAME, groupbox)
self.backup = QtGui.QRadioButton(_("Backup my %s device") % conf.PRODUCTNAME, groupbox)
def validatePage(_self): if self.create.isChecked(): self.reverse = False else: self.reverse = True return True
processes = self.WMI.Win32_Process(Name=conf.WINDOWSEXE)
processes = [] for p in self.WMI.Win32_Process(): if "ufo" in p.Name or p.Name == conf.WINDOWSEXE: processes.append(p)
def check_process(self): logging.debug("Checking UFO process") # TODO: Get pid for possible kill processes = self.WMI.Win32_Process(Name=conf.WINDOWSEXE) logging.debug("ufo process : " + str(processes)) if len(processes) > 1: logging.debug(str([ x.Name for x in processes if x.ProcessId != os.getpid() ])) self.error_alr...
" :\t" + str(self.user_readable(self.get_conf(sel))) + \ " -> " + str(self.user_readable(self.registred_selections[sel]['value'])) + "\n"
" :\t" + unicode(self.user_readable(self.get_conf(sel))) + \ " -> " + unicode(self.user_readable(self.registred_selections[sel]['value'])) + "\n"
def get_changes_string(self): msg = "" for sel in self.registred_selections.keys(): if self.registred_selections[sel]['value'] != self.get_conf(self.registred_selections[sel]['confid']): msg += " - " + self.registred_selections[sel]['short'] + \ " :\t" + str(self.user_readable(self.get_conf(sel))) + \ " -> " + ...
disk.writeImage(image, device, volume=volume, callback=callback):
disk.writeImage(image, device, volume=volume, callback=callback)
def write_image(self, image, device, volume="", callback=None): import disk disk.writeImage(image, device, volume=volume, callback=callback):
"showRuntimeError.warning.HostAudioNotResponding")
"showRuntimeError.warning.HostAudioNotResponding," + "showRuntimeError.warning.3DSupportIncompatibleAdditions")
def create_virtual_machine(self, create_vmdk = True): logging.debug("Creating VM") self.vbox.create_machine(conf.VM, conf.OS) self.vbox.open_machine(conf.VM)
'args' : (self.credentials, self.keyring_valid, self.vbox.current_machine)})
'args' : (self.credentials, self.keyring_valid)})
def onMachineStateChange(self, state): last_state = self.vbox.current_machine.last_state # The virtual machine is starting if state == self.vbox.constants.MachineState_Running and \ last_state == self.vbox.constants.MachineState_Starting:
QtCore.Qt.Popup
QtCore.Qt.ToolTip
def __init__(self, title, msg=None, progress=False, vlayout=None, fake=False, rearrange_callback=None): if sys.platform == "win32": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.ToolTip elif sys.platform == "linux2": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.X11BypassWindowManagerHint | \ QtCore.Qt.Po...
self.timer.start(1)
else: self.show_timer.stop()
def opacity_timer(self): if self.currentAlpha <= 255: self.currentAlpha += 15 self.timer.start(1) self.setWindowOpacity(1. / 255. * self.currentAlpha)
self.timer = QtCore.QTimer(self) self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.opacity_timer) self.timer.start(1)
self.show_timer.start(1)
def showEvent(self, event): self.timer = QtCore.QTimer(self) self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.opacity_timer) self.timer.start(1) self.resize_to_minimum() self.rearrange_callback()
threading.Thread(target=self.write_image, args=(unicode(self.source), unicode(self.target)), kwargs=kwargs).start()
self.process_thread = threading.Thread(target=self.write_image, args=(unicode(self.source), unicode(self.target)), kwargs=kwargs) self.process_thread.start() def done(self, result): if not self.reverse and self.generating and result == QtGui.QWizard.Rejected: response = gui.dialog_question(title=_("Do you really want ...
def launch_process(self): self.button(QtGui.QWizard.NextButton).setEnabled(False) self.progress.setRange(0, 100) kwargs = {} kwargs["callback"] = self.update_progress import threading threading.Thread(target=self.write_image, args=(unicode(self.source), unicode(self.target)), kwargs=kwargs).start()
def get_free_space(self): size = self.device_size for part in self.parts: size -= part["size"] return size def update_sliders(self): if not self.parts or not self.device_size: return self.button(QtGui.QWizard.NextButton).setEnabled(True) self.resize_label.setEnabled(True) self.splitter.setEnabled(True) sizes = [] fr...
def repart(self, device, partitions, device_size, c, h, s): import mbr mb = mbr.MBR(device) mb.generate(partitions, device_size, c, h, s) mb.write(device) return mb
import time
def write_image(self, image, device, callback=None): if tarfile.is_tarfile(image):
if self.reverse: total_size = self.get_device_size(image) * 512 else: total_size = self.total_size
total_size = self.device_size
def write_image(self, image, device, callback=None): if tarfile.is_tarfile(image):
status = STATUS_WRITING
def dd(self, src, dest, callback=None, bs=32768, count = -1, skip=0, seek=0): if type(src) in (str, unicode): srcfile = self.backend.open(src) else: srcfile = src
while (count == -1) or (count > 0 and status == STATUS_WRITING):
while self.generating and (count == -1 or count > 0):
def dd(self, src, dest, callback=None, bs=32768, count = -1, skip=0, seek=0): if type(src) in (str, unicode): srcfile = self.backend.open(src) else: srcfile = src
sizes.append(self.get_partition_size(part))
sizes.append(_self.get_partition_size(part))
def validatePage(_self): if self.reverse: missing_device_title = _("Missing source device") missing_device_msg = _("Please select a source device") missing_file_title = _("Missing target image") missing_file_msg = _("Please specify a target image") else: missing_device_title = _("Missing target device") missing_device_...
_self.edit.textChanged.connect(self.on_text_changed)
_self.edit.textChanged.connect(_self.on_text_changed)
def create_file_chooser_layout(_self, reverse): hlayout = QtGui.QHBoxLayout() _self.edit = edit = QtGui.QLineEdit() _self.edit.textChanged.connect(self.on_text_changed) browse = QtGui.QPushButton("...") browse.clicked.connect(_self.on_file_select) browse.setMaximumWidth(20) add_to_layout(hlayout, edit) add_to_layout(hl...
_self.usb_list.currentRowChanged.connect(self.on_select_device)
_self.usb_list.currentRowChanged.connect(_self.on_select_device)
def create_device_chooser_layout(_self): _self.usb_list = QtGui.QListWidget() _self.usb_list.currentRowChanged.connect(self.on_select_device)
self.resize_label = QtGui.QLabel(_("Partition sizes :<br>You can use the following default values "
_self.resize_label = QtGui.QLabel(_("Partition sizes :<br>You can use the following default values "
def create_device_resize_layout(_self): layout = QtGui.QVBoxLayout() self.resize_label = QtGui.QLabel(_("Partition sizes :<br>You can use the following default values " "or you can resize the partition sizes to meet your needs :<br><br>")) self.resize_label.setWordWrap(True) self.resize_label.setEnabled(False) add_to_l...
self.resize_label.setWordWrap(True) self.resize_label.setEnabled(False) add_to_layout(layout, self.resize_label) self.splitter = splitter = QtGui.QSplitter() self.splitter.setMinimumSize(600, 32) self.splitter.setStyleSheet("QSplitter { border: 1px solid black; }") self.splitter.splitterMoved.connect(self.splitter_move...
_self.resize_label.setWordWrap(True) _self.resize_label.setEnabled(False) add_to_layout(layout, _self.resize_label) _self.splitter = splitter = QtGui.QSplitter() _self.splitter.setMinimumSize(600, 32) _self.splitter.setStyleSheet("QSplitter { border: 1px solid black; }") _self.splitter.splitterMoved.connect(_self.split...
def create_device_resize_layout(_self): layout = QtGui.QVBoxLayout() self.resize_label = QtGui.QLabel(_("Partition sizes :<br>You can use the following default values " "or you can resize the partition sizes to meet your needs :<br><br>")) self.resize_label.setWordWrap(True) self.resize_label.setEnabled(False) add_to_l...
label = QtGui.QLabel(_("%s has been successfully installed " "on your device. You can use it right away.\n\n" "Enjoy !") % conf.PRODUCTNAME) label.setWordWrap(True) layout.addWidget(label)
self.finish_label = QtGui.QLabel(_("%s has been successfully installed " "on your device. You can use it right away.\n\n" "Enjoy !") % conf.PRODUCTNAME) self.finish_label.setWordWrap(True) layout.addWidget(self.finish_label)
def create_finish_page(self): page = QtGui.QWizardPage() page.setTitle(_("Operation successfull !")) layout = QtGui.QVBoxLayout()
if tarfile.is_tarfile(image):
if tarfile.is_tarfile(image) and not image.startswith("/dev"):
def write_image(self, image, device, callback=None): self.generating = True if tarfile.is_tarfile(image):
def dd(self, src, dest, callback=None, bs=32768, count = -1, skip=0, seek=0):
def dd(self, src, dest, callback=None, bs=1024*1024, count = -1, skip=0, seek=0):
def dd(self, src, dest, callback=None, bs=32768, count = -1, skip=0, seek=0): if type(src) in (str, unicode): srcfile = self.backend.open(src) else: srcfile = src
raise Exception("Implemented in subclasses")
if platform.architecture()[0] == '64bit' and path.isdir('/usr/lib64/virtualbox'): conf.BIN = '/usr/lib64/virtualbox' elif platform.architecture()[0] == '32bit' and path.isdir('/usr/lib/virtualbox'): conf.BIN = '/usr/lib/virtualbox' else: conf.BIN = path.dirname(self.call(["which", "VirtualBox"], output=True)[1].strip()...
def look_for_virtualbox(self): raise Exception("Implemented in subclasses")
"msg" : _('Installing %s for Python (required by UFO)') % (component,),
"msg" : _('Installing %s (required by UFO)') % (component,),
def get_generic_installation_messages(self, component): return { "title" : _("Please wait"), "msg" : _('Installing %s for Python (required by UFO)') % (component,), "success_msg" : _("%s was successfully installed") % (component,), "error_msg" : _("An error occurred while installing %s") % (component,) }
if platform.architecture()[0]=='64bit' and path.isdir('/usr/lib64/virtualbox') : conf.BIN = '/usr/lib64/virtualbox' elif platform.architecture()[0]=='32bit' and path.isdir('/usr/lib/virtualbox') : conf.BIN = '/usr/lib/virtualbox' else: conf.BIN = path.dirname(self.call(["which", "VirtualBox"], output=True)[1].strip()) ...
LinuxBackend.look_for_virtualbox(self)
def look_for_virtualbox(self): logging.debug("Checking VirtualBox binaries") if not path.exists(path.join(conf.BIN, self.VIRTUALBOX_EXECUTABLE)): logging.debug("Installing Agorabox repository for VirtualBox") gui.wait_command(["yum", "-y", "install", "yum-priorities"], **self.get_generic_installation_messages("yum-prio...
**self.get_generic_installation_messages())
**self.get_generic_installation_messages("VirtualBox 3"))
def look_for_virtualbox(self): logging.debug("Checking VirtualBox binaries") vbox_path = utils.call(["which", "VirtualBox"], output=True)[1].strip() if not os.path.lexists(vbox_path): open("/etc/apt/sources.list", "a").write("deb http://download.virtualbox.org/virtualbox/debian %s non-free\n" % (self.codename.lower(), ...
OSBackend.look_for_virtualbox(self)
LinuxBackend.look_for_virtualbox(self)
def look_for_virtualbox(self): logging.debug("Checking VirtualBox binaries") vbox_path = utils.call(["which", "VirtualBox"], output=True)[1].strip() if not os.path.lexists(vbox_path): open("/etc/apt/sources.list", "a").write("deb http://download.virtualbox.org/virtualbox/debian %s non-free\n" % (self.codename.lower(), ...
def install_virtualbox(self):
def checking_pyqt(self):
def install_virtualbox(self): pass
if not conf.MODEL and not conf.VOLUME and not conf.ROOTUUID:
if not conf.MODEL and not conf.VOLUME and not conf.ROOTUUID and conf.LIVECD:
def find_device(self): try_times = 10
control.setEnabled(False)
def send_debug_reports(): control = self.sender() control.setEnabled(False) import urllib report_files = glob.glob(os.path.join(os.path.dirname(conf.LOGFILE ), "*"))
reports = "REPORT SENDED MANUALLY BY USER (" + user + ")"
if control.text_edit.toPlainText() == desc: dialog_info(_("Description is empty"), _("Please describe your problem in the dedicated text area.")) return reports = "Report sended manualy by user (" + user + ")\n\n" reports += control.text_edit.toPlainText() + "\n"
def send_debug_reports(): control = self.sender() control.setEnabled(False) import urllib report_files = glob.glob(os.path.join(os.path.dirname(conf.LOGFILE ), "*"))
params = urllib.urlencode({'report': reports})
params = urllib.urlencode({'report': str(reports.toUtf8())})
def send_debug_reports(): control = self.sender() control.setEnabled(False) import urllib report_files = glob.glob(os.path.join(os.path.dirname(conf.LOGFILE ), "*"))
pass custom_layout = QtGui.QHBoxLayout() custom_layout.addSpacing(30)
dialog_info(_("No internet connection found"), _("You need an internet connection to submit you bug report."), error=True) def clear_desc_area(): control = self.sender() if control.toPlainText() == desc: control.setHtml("&nbsp;") control.selectAll() custom_layout = QtGui.QVBoxLayout() custom_layout.addSpacing(15) hla...
def send_debug_reports(): control = self.sender() control.setEnabled(False) import urllib report_files = glob.glob(os.path.join(os.path.dirname(conf.LOGFILE ), "*"))
custom_layout.addWidget(send_button) custom_layout.addSpacing(30)
send_button.text_edit = QtGui.QTextEdit("<i><font color= self.connect(send_button.text_edit, QtCore.SIGNAL('cursorPositionChanged()'), clear_desc_area) send_button.text_edit.setMaximumHeight(70) vlayout.addWidget(send_button.text_edit) vlayout.addWidget(send_button) hlayout.addSpacing(30) hlayout.addLayout(vlayout) hla...
def send_debug_reports(): control = self.sender() control.setEnabled(False) import urllib report_files = glob.glob(os.path.join(os.path.dirname(conf.LOGFILE ), "*"))
if self.call([ path.join(conf.BIN, "USB_Disk_Eject.exe"), "/REMOVELETTER", mntpoint], shell=True) != 0:
self.call([ path.join(conf.BIN, "USB_Disk_Eject.exe"), "/REMOVELETTER", mntpoint[:len(mntpoint)-1]], shell=True) time.sleep(0.5) if os.path.exists(mntpoint):
def umount_device(self, mntpoint): if self.call([ path.join(conf.BIN, "USB_Disk_Eject.exe"), "/REMOVELETTER", mntpoint], shell=True) != 0: return False return True
removed_space = removed_space + os.stat(path.join(path.dirname(conf.DATA_DIR), file.strip())).st_size
try: size = os.stat(path.join(path.dirname(conf.DATA_DIR), file.strip())).st_size except: continue removed_space = removed_space + size
def check_update(backend): logging.debug("Using launcher version : " + str(conf.VERSION)) try: logging.debug("Checking updates") local_version = map(int, conf.VERSION.split('.')) latest_version, latest_size, latest_real_size = get_latest_version() if local_version < latest_version : logging.debug("Updating to new versi...
self.set_credentials(password)
self.set_credentials(conf.USER, password)
def configure_virtual_machine(self, create_vmdk = True): if not conf.VMDK and not conf.CONFIGUREVM: logging.debug("Skipping configuration of the VM") self.vbox.close_session() return
gettext.install('vlaunch', path.join(DATA_DIR, "locale2"), languages=[LANGUAGE], unicode=True)
gettext.install('vlaunch', path.join(DATA_DIR, "locale"), languages=[LANGUAGE], unicode=True)
def make_path(base, value): if value: return path.normpath(path.join(base,path.expanduser(value))) else: return ""
logging.debug("Settings CPU capabilities: VT=%s PAE=%s nested_paging=%s" % (conf.PAE, conf.VT, conf.NESTEDPAGING))
logging.debug("Settings CPU capabilities: VT=%s PAE=%s nested_paging=%s" % \ (conf.PAE, conf.VT, conf.NESTEDPAGING))
def configure_virtual_machine(self, create_vmdk = True): if not conf.VMDK and not conf.CONFIGUREVM: logging.debug("Skipping configuration of the VM") self.vbox.close_session() return
elif state == self.vbox.constants.MachineState_PoweredOff and \ (last_state == self.vbox.constants.MachineState_Stopping or \ last_state == self.vbox.constants.MachineState_Aborted):
elif (state == self.vbox.constants.MachineState_PoweredOff and \ last_state == self.vbox.constants.MachineState_Stopping) or \ state == self.vbox.constants.MachineState_Aborted:
def onMachineStateChange(self, state):
"--relaunch", conf.SCRIPT_PATH, "--script-path", executable ]
"--relaunch", conf.SCRIPT_PATH ]
def check_update(backend): logging.debug("Using launcher version : " + str(conf.VERSION)) try: logging.debug("Checking updates") local_version = map(int, conf.VERSION.split('.')) latest_version, latest_size, latest_real_size = get_latest_version() if local_version < latest_version : logging.debug("Updating to new versi...
self.menu = QtGui.QMenu() action_about = QtGui.QAction(QtGui.QIcon(os.path.join(conf.IMGDIR, "about.png")), QtCore.QString(_("About")), self); action_about.setStatusTip(_("Get informations about UFO")) action_settings = QtGui.QAction(QtGui.QIcon(os.path.join(conf.IMGDIR, "settings.png")), QtCore.QString(_("Settings..."...
def __init__(self): QtGui.QApplication.__init__(self, sys.argv)
self.menu = QtGui.QMenu() self.action_about = QtGui.QAction(QtGui.QIcon(os.path.join(conf.IMGDIR, "about.png")), QtCore.QString(_("About")), self); self.action_about.setStatusTip(_("Get informations about UFO")) self.action_settings = QtGui.QAction(QtGui.QIcon(os.path.join(conf.IMGDIR, "settings.png")), QtCore.QString(...
def __init__(self): QtGui.QSystemTrayIcon.__init__(self) self.setIcon(QtGui.QApplication.windowIcon()) self.setVisible(True) self.menu = QtGui.QMenu() self.action_about = QtGui.QAction(QtGui.QIcon(os.path.join(conf.IMGDIR, "about.png")), QtCore.QString(_("About")), self); self.action_about.setStatusTip(_("Get informa...
def about(self): QtGui.QMessageBox.about(main, QtCore.QString(_("About the UFO launcher")), QtCore.QString(_("Version ") + str(conf.VERSION) + "<br><br>Copyright (C) 2009 Agorabox<br><br>" + _("For more information, please visit") + " http://ufo.agorabox.org")) def settings(self): settings = Settings() settings.show()...
def activate(self, reason): if reason == QtGui.QSystemTrayIcon.DoubleClick: if self.minimized: app.normalize_window() self.minimized = False else: app.minimize_window() self.minimized = True elif reason != QtGui.QSystemTrayIcon.Context: if self.balloon: self.balloon.show()
input = dialog_question(_("Settings validation"), msg, button1=yes, button2=no) if input == yes:
if True:
def on_validation(self): if len(self.registred_selections) > 0: yes = _("Yes") no = _("No") msg = _("Would you validate the following changes ?") + "\n\n" msg += self.get_changes_string() input = dialog_question(_("Settings validation"), msg, button1=yes, button2=no) if input == yes: cp = ConfigParser() cp.read(conf.c...
input = dialog_question(_("Cancel changes"), msg, button1=yes, button2=no) if input == yes:
if True: self.setVisible(False) self.close()
def on_cancel(self): if len(self.registred_selections) > 0: yes = _("Yes") no = _("No") msg = _("Would you cancel the following changes ?") + "\n\n" msg += self.get_changes_string() input = dialog_question(_("Cancel changes"), msg, button1=yes, button2=no) if input == yes: self.reject() else: self.reject()
input = dialog_question(_("Return to default"), msg, button1=yes, button2=no) if input == yes:
if True:
def on_default(self): yes = _("Yes") no = _("No") msg = _("Would you reset all settings to default ?") input = dialog_question(_("Return to default"), msg, button1=yes, button2=no) if input == yes: cp = ConfigParser() cp.read(conf.conf_file) for tab in conf.settings: for setting in tab['settings']: if setting.has_key(...
if options.update: self.DATA_DIR = path.join(options.update, ".data") else: self.DATA_DIR = "" self.BIN = "" if sys.platform == "linux2": if self.LIVECD: self.DATA_DIR = os.environ["_MEIPASS2"] else: if not self.DATA_DIR: self.DATA_DIR = path.join(path.dirname(path.dirname(self.SCRIPT_PATH)), ".data") vbox_path = uti...
def __init__(self): self.handlers = []
self.create_ballon_custom_layout(),
self.create_balloon_custom_layout(),
def __init__(self, parent=None, tabs=None, fields=None, show_default_button=True, no_reboot=False): super(Settings, self).__init__(parent)
def create_ballon_custom_layout(self):
def create_balloon_custom_layout(self):
def create_ballon_custom_layout(self): custom_layout = QtGui.QVBoxLayout() val_layout = QtGui.QHBoxLayout() val_layout.addSpacing(30) self.balloon_preview = BalloonMessage(self, fake = True, title =_("Message title"), msg = _("Message contents")) val_layout.addWidget(self.balloon_preview) val_layout.addSpacing(30) ...
self.balloon_preview = BalloonMessage(self, fake = True, title =_("Message title"), msg = _("Message contents"))
self.balloon_preview = BalloonMessage(title=_("Message title"), fake= True, msg=_("Message contents"))
def create_ballon_custom_layout(self): custom_layout = QtGui.QVBoxLayout() val_layout = QtGui.QHBoxLayout() val_layout.addSpacing(30) self.balloon_preview = BalloonMessage(self, fake = True, title =_("Message title"), msg = _("Message contents")) val_layout.addWidget(self.balloon_preview) val_layout.addSpacing(30) ...
self.action = QtGui.QAction(QtCore.QString(_("About UFO...")), self); self.action.setStatusTip(_("Get informations about UFO")) self.connect(self.action, QtCore.SIGNAL("triggered()"), self.about);
def __init__(self): QtGui.QSystemTrayIcon.__init__(self) self.setIcon(QtGui.QApplication.windowIcon()) self.setVisible(True) self.action = QtGui.QAction(QtCore.QString(_("About UFO...")), self); self.action.setStatusTip(_("Get informations about UFO")) self.connect(self.action, QtCore.SIGNAL("triggered()"), self.abou...
self.menu.addAction(self.action)
self.action_about = QtGui.QAction(QtCore.QString(_("About")), self); self.action_about.setStatusTip(_("Get informations about UFO")) self.action_settings = QtGui.QAction(QtCore.QString(_("Settings...")), self); self.action_settings.setStatusTip(_("Configure your UFO device")) self.connect(self.action_about, QtCore.SIG...
def __init__(self): QtGui.QSystemTrayIcon.__init__(self) self.setIcon(QtGui.QApplication.windowIcon()) self.setVisible(True) self.action = QtGui.QAction(QtCore.QString(_("About UFO...")), self); self.action.setStatusTip(_("Get informations about UFO")) self.connect(self.action, QtCore.SIGNAL("triggered()"), self.abou...
def about(self): QtGui.QMessageBox.about(main, QtCore.QString(_("About the UFO launcher")), QtCore.QString(_("Version ") + str(conf.VERSION) + "<br><br>Copyright (C) 2009 Agorabox<br><br>" + _("For more information, please visit") + " http://ufo.agorabox.org"))
def activate(self, reason): if reason == QtGui.QSystemTrayIcon.DoubleClick: if self.minimized: app.normalize_window() self.minimized = False else: app.minimize_window() self.minimized = True elif reason != QtGui.QSystemTrayIcon.Context: if self.balloon: self.balloon.show()
msg=_("The size of the source you have selected (%d Mo)" " is bigger than the size of the selected target device (%d Mo)." "<br><br>Please select a source equal or smaller than the target key.") % (str(source_size / (1024 * 1024)), str(target_size / (1024 * 1024))))
msg=_("The size of the source you have selected (%d Mo)" " is bigger than the size of the selected target device (%d Mo)." "<br><br>Please select a source equal or smaller than the target key.") % (source_size / 1024 / 1024, target_size / 1024 / 1024))
def validatePage(_self): filename = self.source.text() if not filename or not os.path.exists(filename): gui.dialog_info(title=_("Missing source image"), msg=_("Please specify a source image or download one by " "clicking the 'Download it' button")) return False
print pt[6], pt[7], pt[6] & 0x3F, pt[6] & 0xC0, pt[7] | (pt[6] & 0xC0)
def __init__(self, f): self.partitions = [] f.seek(0, os.SEEK_SET) data = f.read(512)
cylinders = size / cyl_units - 1
cylinders = size / cyl_units
def generate(self, partitions, size, c, h, s): cyl_units = h * s * BLOCK_SIZE totalsize = cyl_units offset = 0 lba = 1 start_head = 0 start_sector = 2 self.partitions = [] for n, part in enumerate(partitions): type, size, bootable = part["type"], part["size"], part["bootable"] if not size: cylinders = c - offset else: ...
self.persistent_balloon = MultiSmartDictBalloonMessage(self, title=_("UFO informations balloon")) self.fit_balloon(self.persistent_balloon)
self.persistent_balloon = MultiSmartDictBalloonMessage(title=_("UFO informations balloon"), rearrange_callback=self.rearrange_balloons) self.balloons = [ self.persistent_balloon ]
def __init__(self): QtGui.QSystemTrayIcon.__init__(self)
self.temporary_balloon = BalloonMessage(parent=self, title=title,
self.temporary_balloon = BalloonMessage(title=title,
def create_temporary_balloon(self, title, msg, progress, timeout, vlayout): if self.temporary_balloon: self.destroy_temporary_balloon()
resize_callback=self.move_persistent_balloon) self.fit_balloon(self.temporary_balloon)
rearrange_callback=self.rearrange_balloons) self.balloons.insert(0, self.temporary_balloon)
def create_temporary_balloon(self, title, msg, progress, timeout, vlayout): if self.temporary_balloon: self.destroy_temporary_balloon()
def move_persistent_balloon(self, overhead): if self.persistent_balloon: self.fit_balloon(self.persistent_balloon, overhead) def fit_balloon(self, balloon, overhead=0): if overhead: overhead = overhead + 10 if self.geometry().y() < screenRect.height() / 2: y = self.geometry().bottom() + 10 + overhead else: y = self.ge...
def rearrange_balloons(self): self.on_top = self.geometry().y() < screenRect.height() / 2 if self.on_top: balloon_y = self.geometry().bottom() + 10 else: balloon_y = self.geometry().top() for balloon in self.balloons: if balloon.isVisible(): if not self.on_top: balloon_y = balloon_y - balloon.height() - 10 balloon.mo...
def update_persistent_balloon_progress(self, key, progress): if self.persistent_balloon.sections.has_key(key): self.persistent_balloon.sections[key].set_progress(progress)
def __init__(self, parent, title, msg=None, progress=False, vlayout=None, fake=False, resize_callback=None):
def __init__(self, title, msg=None, progress=False, vlayout=None, fake=False, rearrange_callback=None):
def __init__(self, parent, title, msg=None, progress=False, vlayout=None, fake=False, resize_callback=None): if sys.platform == "win32": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.ToolTip elif sys.platform == "linux2": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.X11BypassWindowManagerHint | \ QtCore....
self.parent = parent
def __init__(self, parent, title, msg=None, progress=False, vlayout=None, fake=False, resize_callback=None): if sys.platform == "win32": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.ToolTip elif sys.platform == "linux2": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.X11BypassWindowManagerHint | \ QtCore....
self.fake = fake
def __init__(self, parent, title, msg=None, progress=False, vlayout=None, fake=False, resize_callback=None): if sys.platform == "win32": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.ToolTip elif sys.platform == "linux2": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.X11BypassWindowManagerHint | \ QtCore....
self.resize_callback = resize_callback
def __init__(self, parent, title, msg=None, progress=False, vlayout=None, fake=False, resize_callback=None): if sys.platform == "win32": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.ToolTip elif sys.platform == "linux2": flags = QtCore.Qt.WindowStaysOnTopHint | \ QtCore.Qt.X11BypassWindowManagerHint | \ QtCore....
self.move(screenRect.width() - self.width() - 10, self.y()) if self.resize_callback: self.resize_callback(self.height())
self.resize_to_minimum() self.rearrange_callback()
def resizeEvent(self, evt): if self.fake: return
if self.resize_callback: self.resize_callback(0)
self.rearrange_callback()
def hideEvent(self, evt): if self.resize_callback: self.resize_callback(0)
if self.resize_callback: self.resize_callback(0)
self.rearrange_callback()
def closeEvent(self, evt): if self.resize_callback: self.resize_callback(0)
if self.resize_callback: self.resize_callback(self.height())
self.resize_to_minimum() self.rearrange_callback()
def showEvent(self, event): self.timer = QtCore.QTimer(self) self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.opacity_timer) self.timer.start(1) if self.resize_callback: self.resize_callback(self.height())