def on_radOldKernel_toggled(self, widget): if widget.get_active(): message = "%s\n\n%s" % ( _("Once removed you will not be able to boot these kernels!"), self.lblMaintenanceHelp.get_label().replace("\n", " ")) WarningDialog(self.btnMaintenance.get_label(), message) self.fillTreeViewMaintenance()
def on_radUnneeded_toggled(self, widget): if widget.get_active(): message = "%s\n\n%s" % ( _("You might need to run this several times."), self.lblMaintenanceHelp.get_label().replace("\n", " ")) WarningDialog(self.btnMaintenance.get_label(), message) self.fillTreeViewMaintenance()
def on_some_ftp_error(self, widget, error_text): for i in xrange(len(self.available_plugins_model)): self.available_plugins_model[i][C_UPGRADE] = False self.progressbar.hide() log.error(error_text) traceback.print_exc() WarningDialog(_('Ftp error'), error_text, self.window)
def fill_treeview_ddm(self): # Fill a list with supported hardware self.get_supported_hardware() # columns: checkbox, image (logo), device, driver columnTypes = ['bool', 'GdkPixbuf.Pixbuf', 'str'] # Keep some info from the user showHw = [] for hw in self.hardware: showHw.append([hw[0], hw[1], hw[2]]) # Fill treeview self.tvDDMHandler.fillTreeview(contentList=showHw, columnTypesList=columnTypes, firstItemIsColName=True, fontSize=12000) # Show message if nothing is found or hardware is not supported title = _("Hardware scan") if self.notSupported: if len(self.hardware) < 2: self.set_buttons_state(False) msg = _("There are no available drivers for your hardware:") msg = "{}\n\n{}".format(msg, '\n'.join(self.notSupported)) self.log.write(msg, 'fill_treeview_ddm') WarningDialog(title, msg) elif len(self.hardware) < 2: self.set_buttons_state(False) msg = _("DDM did not find any supported hardware.") self.log.write(msg, 'fill_treeview_ddm') MessageDialog(title, msg)
def on_radDowngradable_toggled(self, widget): if widget.get_active(): message = "%s\n\n%s" % ( _("Downgrading packages may break your system!"), self.lblMaintenanceHelp.get_label().replace("\n", " ")) WarningDialog(self.btnMaintenance.get_label(), message) self.fillTreeViewMaintenance()
def _show_warn_dialog(self, uri): from dialogs import WarningDialog d = WarningDialog(None) msg = (_("Playlist entry '%s' will be omitted from the archive since " "it is not a local file") % mesk.uri.unescape(str(uri))) d.set_markup(msg) d.run() d.destroy()
def on_btnExecute_clicked(self, widget): if exists(self.device["path"]): arguments = [] arguments.append("-d {}".format(self.device["path"])) clear = self.chkFormatDevice.get_active() repair = self.chkRepairDevice.get_active() iso = self.device["new_iso"] iso_path = self.txtIso.get_text().strip() # ISO path does not exist if iso != iso_path: msg = _( "Cannot add ISO from path: {}.\n" "Please, remove the ISO path or browse for an existing ISO." ) WarningDialog(self.btnExecute.get_label(), msg.format(iso_path)) return True # Check if there is enough space available = self.device["available"] if self.chkFormatDevice.get_active(): available = self.device["size"] if (available) - self.device["new_iso_required"] < 0: msg = _( "There is not enough space available on the pen drive.\n" "Please, remove unneeded files before continuing.") WarningDialog(self.btnExecute.get_label(), msg) return True if clear: arguments.append("-f") arguments.append("-b") if repair: arguments.append("-r") arguments.append("-b") arguments.append("-g") # This should use the history file to get the original hash arguments.append("-s") if exists(iso): arguments.append("-i \"{}\"".format(iso)) arguments.append("-s") cmd = "usb-creator {}".format(" ".join(arguments)) self.log.write("Execute command: {}".format(cmd)) self.exec_command(cmd)
def setColorButtonColor(self, colorbutton, hex_color): rgba_color = Gdk.RGBA() hex_color = hex_color.strip() if hex_color[0:1] != '#': hex_color = "#%s" % hex_color if rgba_color.parse(hex_color): colorbutton.set_rgba(rgba_color) else: msg = _("Could not set color: %s" % hex_color) WarningDialog(self.btnColors.get_label(), msg)
def _on_message_textview_key_press_event(self, widget, event): if event.get_state() & Gdk.ModifierType.MOD1_MASK and \ event.keyval == Gdk.KEY_l: if not self.chat_control.contact.supports(NS_XHTML_IM): from dialogs import WarningDialog WarningDialog('Warning', _('This contact does not support XHTML_IM'), self.chat_control.parent_win.window) return True self.on_image_button_clicked(widget) return True
def run(self): self.set_locale() self.set_timezone() if has_internet_connection(): self.queue_progress() shell_exec("apt-get update") self.applications() self.language_specific() else: msg = _( "SolydXK System Settings cannot download and install the software localization packages\n" "Please repeat this process when you established an internet connection." ) WarningDialog(_("No internet connection", msg))
def on_uninstall_plugin_button_clicked(self, widget): selection = self.installed_plugins_treeview.get_selection() model, iter = selection.get_selected() if iter: plugin = model.get_value(iter, PLUGIN) plugin_name = model.get_value(iter, NAME) is_active = model.get_value(iter, ACTIVE) try: gajim.plugin_manager.remove_plugin(plugin) except PluginsystemError as e: WarningDialog(_('Unable to properly remove the plugin'), str(e), self.window) return model.remove(iter)
def tv_checkbox_toggled(self, obj, path, colNr, toggleValue): path = int(path) model = self.tvDDM.get_model() itr = model.get_iter(path) description = model[itr][2].lower() if 'pae' in description and not toggleValue and self.paeBooted: title = _("Remove kernel") msg = _( "You cannot remove a booted kernel.\nPlease, boot another kernel and try again." ) self.log.write(msg, 'tv_checkbox_toggled') WarningDialog(title, msg) model[itr][0] = True
def on_inslall_upgrade_clicked(self, widget): self.inslall_upgrade_button.set_property('sensitive', False) self.errors = '' def on_error(func, path, error): if func == os.path.islink: # if symlink os.unlink(path) return # access is denied or other # WarningDialog(_('Can\'t remove dir'), error[1], self.window) self.errors += str(error[1]) name_list = [] for i in range(len(self.model)): if self.model[i][C_UPGRADE]: name_list.append(self.model[i][C_NAME]) for name in name_list: # remove dirs target_dir = os.path.join(gajim.MY_EMOTS_PATH, name) if os.path.isdir(target_dir): rmtree(target_dir, False, on_error) # unzip new files zip_file = os.path.join(self.__path__, 'emoticons_pack.zip') with zipfile.ZipFile(zip_file, 'r') as myzip: namelist = myzip.namelist() for n in namelist: if not n.startswith(name): continue try: icon_file = myzip.extract(n, path=gajim.MY_EMOTS_PATH) except Exception as e: self.errors += str(e) # unset all checkbattons for i in range(len(self.model)): self.model[i][C_UPGRADE] = False if self.errors: WarningDialog(_('Not fully installed'), 'Access is denied or other', self.window) else: # show dialog dialog = HigDialog(None, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, '', _('All selected emoticons installed(upgraded)')) dialog.set_modal(False) dialog.set_transient_for(self.window) dialog.popup()
def installed_plugins_toggled_cb(self, cell, path): is_active = self.installed_plugins_model[path][ACTIVE] plugin = self.installed_plugins_model[path][PLUGIN] if is_active: gajim.plugin_manager.deactivate_plugin(plugin) else: try: gajim.plugin_manager.activate_plugin(plugin) except GajimPluginActivateException as e: WarningDialog(_('Plugin failed'), str(e), transient_for=self.window) return self.installed_plugins_model[path][ACTIVE] = not is_active
def on_hide(self, widget): for name in self.plugin.config_default_values: if name in ['presets', 'lat', 'lon']: continue widget = self.xml.get_object(name) self.plugin.config[name] = widget.get_text() lat = self.xml.get_object('lat').get_text() lon = self.xml.get_object('lon').get_text() if self.is_valid_coord(lat, lon): self.plugin.config['lat'] = lat self.plugin.config['lon'] = lon if self.plugin.active: self.plugin.activate() else: self.plugin.config['lat'] = '0.0' self.plugin.config['lon'] = '0.0' error_text = 'lat or lon field contains wrong value.' WarningDialog(_('Wrong coordinates'), error_text, self)
def on_key_press(self, widget, event_keyval, event_keymod): # construct event instance from binding event = gtk.gdk.Event(gtk.gdk.KEY_PRESS) # it's always a key-press here event.keyval = event_keyval event.state = event_keymod event.time = 0 # assign current time if event.keyval != gtk.keysyms.u: return if event.state != gtk.gdk.MOD1_MASK: # ALT+u return is_supported = gajim.get_jid_from_account(self.chat_control.account) in jid_to_servers and \ gajim.connections[self.chat_control.account].connection != None if not is_supported: from dialogs import WarningDialog WarningDialog('Warning', _('Your server does not support http uploads'), transient_for=self.chat_control.parent_win.window) return self.on_file_button_clicked(widget)
def on_key_press(self, widget, event_keyval, event_keymod): # construct event instance from binding event = gtk.gdk.Event( gtk.gdk.KEY_PRESS) # it's always a key-press here event.keyval = event_keyval event.state = event_keymod event.time = 0 # assign current time if event.keyval != gtk.keysyms.l: return if event.state != gtk.gdk.MOD1_MASK: # ALT+l return if not self.chat_control.contact.supports(NS_XHTML_IM): from dialogs import WarningDialog WarningDialog('Warning', _('This contact does not support XHTML_IM'), self.chat_control.parent_win.window) return self.on_image_button_clicked(widget)
def _try_install(zip_filename): try: plugin = gajim.plugin_manager.install_from_zip(zip_filename) except PluginsystemError as er_type: error_text = str(er_type) if error_text == _('Plugin already exists'): _on_plugin_exists(zip_filename) return WarningDialog(error_text, '"%s"' % zip_filename, self.window) return if not plugin: show_warn_dialog() return model = self.installed_plugins_model iter_ = model.append( [plugin, plugin.name, False, plugin.activatable], self.get_plugin_icon(plugin)) sel = self.installed_plugins_treeview.get_selection() sel.select_iter(iter_)
# Handle arguments parser = argparse.ArgumentParser(description="DDM") parser.add_argument('-t', action="store_true", help='Testing only: install drivers for pre-defined hardware') parser.add_argument('-f', action="store_true", help='Force DDM to start even in a live environment') args, extra = parser.parse_known_args() test = args.t force = args.f # Warn for the use of proprietary drivers title = _("Device Driver Manager") msg = _("Device Driver Manager helps to install proprietary drivers for your hardware.\n" "Only install proprietary drivers if you are sure you really need them.\n" "Usually open drivers are enough.") WarningDialog(title, msg, None, None, True, 'ddm') # Set variables scriptDir = os.path.dirname(os.path.realpath(__file__)) def isRunningLive(): if force: return False liveDirs = ['/live', '/lib/live/mount', '/rofs'] for ld in liveDirs: if os.path.exists(ld): return True return False
def show_warn_dialog(): text = _('Archive is malformed') dialog = WarningDialog(text, '', transient_for=self.window) dialog.set_modal(False) dialog.popup()
if args.reload: arguments.append("-r") if args.clear_upd: clearUpHistory() if args.quick: arguments.append("-q") # Finish arguments string arguments.append("&") msg = _("Update Manager cannot be started in a live environment\n" "You can use the --force argument to start UM in a live environment") if args.pref: if isRunningLive() and not args.force: WarningDialog(umglobal.title, msg, None, None, True, 'update-manager') else: if umglobal.isProcessRunning("updatemanagerpref.py"): print(("updatemanagerpref.py already running - exiting")) else: cmd = "python3 {0}/updatemanagerpref.py {1}".format( scriptDir, " ".join(arguments)) if launcher != "": cmd = "{0} '{1}'".format(launcher, cmd) print(cmd) os.system(cmd) else: if not isRunningLive() and not args.force: if umglobal.isProcessRunning("updatemanagertray.py"): print(("updatemanagertray.py already running - exiting")) else:
def on_btnSave_clicked(self, widget): # Save selected hardware arguments = [] model = self.tvDDM.get_model() itr = model.get_iter_first() while itr is not None: action = 'no change' selected = model.get_value(itr, 0) device = model.get_value(itr, 2) manufacturerId = '' # Check currently selected state with initial state # This decides whether we should install or purge the drivers for hw in self.hardware: self.log.write("Device = {} in {}".format(device, hw[2]), 'on_btnSave_clicked') if device in hw[2]: manufacturerId = hw[4] if hw[0] and not selected: action = 'purge' elif not hw[0] and selected: action = 'install' break self.log.write( "{}: {} ({})".format(action, device, manufacturerId), 'on_btnSave_clicked') # Install/purge selected driver option = "" if action == 'install': option = "-i" elif action == 'purge': option = "-p" if option: driver = '' # Run the manufacturer specific bash script if manufacturerId == '1002': driver = 'ati' elif manufacturerId == '10de': driver = 'nvidia ' elif manufacturerId == '14e4': driver = 'broadcom ' elif 'pae' in manufacturerId: driver = 'pae ' if driver: arguments.append("{} {}".format(option, driver)) # Get the next in line itr = model.iter_next(itr) # Execute the command if arguments: if '-i' in arguments and not hasInternetConnection(): title = _("No internet connection") msg = _( "You need an internet connection to install the additional software.\n" "Please, connect to the internet and try again.") WarningDialog(title, msg) else: # Warn for use of Backports if self.chkBackports.get_active(): answer = QuestionDialog( self.chkBackports.get_label(), _("You have selected to install drivers from the backports repository whenever they are available.\n\n" "Although you can run more up to date software using the backports repository,\n" "you introduce a greater risk of breakage doing so.\n\n" "Are you sure you want to continue?")) if not answer: self.chkBackports.set_active(False) return True arguments.append("-b") # Testing if self.test: arguments.append("-t") command = "ddm {}".format(" ".join(arguments)) self.log.write("Command to execute: {}".format(command), 'on_btnSave_clicked') self.exec_command(command)
def get_ati(self): # Debian Wiki: https://wiki.debian.org/ATIProprietary # Supported devices 14.9 (Jessie): http://support.amd.com/en-us/kb-articles/Pages/AMDCatalyst14-9LINReleaseNotes.aspx manufacturerId = '1002' startSeries = 5000 deviceArray = self.get_lspci_info(manufacturerId, 'VGA') if self.test: #deviceArray = [['Advanced Micro Devices [AMD] nee ATI Manhattan [Mobility Radeon HD 5400 Series]', manufacturerId, '68e0']] #deviceArray = [['Advanced Micro Devices, Inc. [AMD/ATI] RV710 [Radeon HD 4350/4550]', manufacturerId, '68e0']] #deviceArray = [['Advanced Micro Devices [AMD/ATI] RS880 [Radeon HD 4290]', manufacturerId, '68e0']] #deviceArray = [['Advanced Micro Devices, Inc. [AMD/ATI] Tonga PRO [Radeon R9 285]', manufacturerId, '6939']] deviceArray = [[ 'Advanced Micro Devices, Inc. [AMD/ATI] Bonaire [FirePro W5100]', manufacturerId, '6649' ]] if deviceArray: self.log.write("Device(s): {}".format(deviceArray), 'get_ati') # Check if fglrx is loaded # If it is: checkbox is selected loadedDrv = self.get_loaded_graphical_driver() self.log.write("Loaded graphical driver: {}".format(loadedDrv), 'get_ati') # Get the manufacturer's logo logo = join(self.mediaDir, 'images/ati.png') # Fill the hardware array for device in deviceArray: self.log.write("ATI device found: {}".format(device[0]), 'get_ati') # Check for supported cards matchObj = re.search( 'radeon\s+[0-9a-z ]+|fire[a-z]+\s+[0-9a-z -]+', device[0], flags=re.IGNORECASE) if matchObj: if " hd " in matchObj.group(0).lower(): # Check if ATI series is above 5000 matchObjSeries = re.search('[0-9]{4}', matchObj.group(0)) if matchObjSeries: series = int(matchObjSeries.group(0)) # Don't show older ATI Radeon HD cards if series < startSeries: break elif 'fire' in matchObj.group(0).lower(): title = _("ATI FirePro/Gl card found") msg = _( "Installing the proprietary driver for an ATI FirePro/Gl card may render your system unbootable.\n\n" "Proceed at your own risk.") self.log.write(msg, 'get_ati') WarningDialog(title, msg) self.log.write("ATI series: {}".format(matchObj.group(0)), 'get_ati') # Check if the available driver is already loaded selected = False driver = 'fglrx' if loadedDrv == driver: selected = True # Fill self.hardware #shortDevice = self.shorten_long_string(device[0], 100) self.hardware.append([ selected, logo, device[0], driver, device[1], device[2] ]) else: self.notSupported.append(device[0])