class PageKde(PreparePageBase): plugin_breadcrumb = 'ubiquity/text/breadcrumb_prepare' restricted_package_name = 'kubuntu-restricted-addons' def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox if 'UBIQUITY_AUTOMATIC' in os.environ: self.page = None return self.controller = controller try: from PyQt4 import uic self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_sufficient_space) # TODO we should set these up and tear them down while on this page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) self.page.vbox1.addWidget(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception, e: # TODO use an inconsistent state? print 'unable to set up power source watch:', e try: self.prepare_network_connection = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_network_connection) except Exception, e: print 'unable to set up network connection watch:', e
def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox if 'UBIQUITY_AUTOMATIC' in os.environ: self.page = None return self.controller = controller try: from PyQt4 import uic self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_sufficient_space) # TODO we should set these up and tear them down while on this page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) self.page.vbox1.addWidget(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception, e: # TODO use an inconsistent state? print 'unable to set up power source watch:', e try: self.prepare_network_connection = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_network_connection) except Exception, e: print 'unable to set up network connection watch:', e
def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox if self.is_automatic: self.page = None return self.controller = controller try: from PyQt4 import uic from PyQt4 import QtGui self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_sufficient_space) self.secureboot_label = self.page.secureboot_label self.disable_secureboot = self.page.disable_secureboot self.password = self.page.password self.verified_password = self.page.verified_password self.password_extra_label = self.page.password_extra_label self.badPassword = self.page.badPassword self.badPassword.setPixmap(QtGui.QPixmap( "/usr/share/icons/oxygen/16x16/status/dialog-warning.png")) # TODO we should set these up and tear them down while on this # page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) self.page.vbox1.addWidget(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception as e: # TODO use an inconsistent state? print('unable to set up power source watch:', e) try: self.prepare_network_connection = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_network_connection) except Exception as e: print('unable to set up network connection watch:', e) except Exception as e: print("Could not create prepare page:", str(e), file=sys.stderr) self.debug('Could not create prepare page: %s', e) self.page = None self.set_using_secureboot(False) self.plugin_widgets = self.page # quick fix for Neon, hide these, work out if the code # should disappear or what should happen self.prepare_sufficient_space.hide() #self.prepare_power_source.hide() #self.prepare_network_connection.hide() self.page.prepare_best_results.hide() # Maui does not need this self.prepare_download_updates.hide() self.prepare_nonfree_software.hide() self.prepare_foss_disclaimer.hide()
def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox self.controller = controller try: from PyQt5 import uic from PyQt5 import QtGui, QtWidgets # No worries, this has nothing to do with NM, we just want the # generic progress indicator from there from ubiquity.frontend.kde_components.nmwidgets import ProgressIndicator self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_minimal_install = self.page.prepare_minimal_install self.qt_label_minimal_install = self.page.qt_label_minimal_install self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.secureboot_label = self.page.secureboot_label self.disable_secureboot = self.page.disable_secureboot self.password = self.page.password self.verified_password = self.page.verified_password self.password_extra_label = self.page.password_extra_label self.badPassword = self.page.badPassword self.badPassword.setPixmap( QtGui.QPixmap( "/usr/share/icons/oxygen/16x16/status/dialog-warning.png")) self.progress_indicator = ProgressIndicator() self.progress_indicator.hide() layout = QtWidgets.QHBoxLayout(self.page.progress_container) layout.addWidget(self.progress_indicator) # TODO we should set these up and tear them down while on this # page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception as e: # TODO use an inconsistent state? print('unable to set up power source watch:', e) if not os.path.exists(minimal_install_rlist_path): self.qt_label_minimal_install.hide() self.prepare_minimal_install.hide() try: self.prepare_network_connection = StateBox(self.page) except Exception as e: print('unable to set up network connection watch:', e) except Exception as e: print("Could not create prepare page:", str(e), file=sys.stderr) self.debug('Could not create prepare page: %s', e) self.page = None self.set_using_secureboot(False) self.plugin_widgets = self.page
def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox if self.is_automatic: self.page = None return self.controller = controller try: from PyQt4 import uic self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_sufficient_space) self.prepare_download_updates.setVisible(False) self.prepare_nonfree_software.setVisible(False) self.prepare_foss_disclaimer.setVisible(False) try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) self.page.vbox1.addWidget(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception as e: # TODO use an inconsistent state? print('unable to set up power source watch:', e) try: self.prepare_network_connection = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_network_connection) except Exception as e: print('unable to set up network connection watch:', e) except Exception as e: print("Could not create prepare page:", str(e), file=sys.stderr) self.debug('Could not create prepare page: %s', e) self.page = None self.plugin_widgets = self.page
class PageKde(PreparePageBase): plugin_breadcrumb = 'ubiquity/text/breadcrumb_prepare' restricted_package_name = 'kubuntu-restricted-addons' def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox if self.is_automatic: self.page = None return self.controller = controller try: from PyQt4 import uic self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_sufficient_space) # TODO we should set these up and tear them down while on this # page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) self.page.vbox1.addWidget(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception as e: # TODO use an inconsistent state? print('unable to set up power source watch:', e) try: self.prepare_network_connection = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_network_connection) except Exception as e: print('unable to set up network connection watch:', e) except Exception as e: print("Could not create prepare page:", str(e), file=sys.stderr) self.debug('Could not create prepare page: %s', e) self.page = None self.plugin_widgets = self.page def enable_download_updates(self, val): self.prepare_download_updates.setEnabled(val) def set_download_updates(self, val): self.prepare_download_updates.setChecked(val) def get_download_updates(self): from PyQt4.QtCore import Qt return self.prepare_download_updates.checkState() == Qt.Checked def set_allow_nonfree(self, allow): if not allow: self.prepare_nonfree_software.setChecked(False) self.prepare_nonfree_software.setVisible(False) self.prepare_foss_disclaimer.setVisible(False) def set_use_nonfree(self, val): if osextras.find_on_path('ubuntu-drivers'): self.prepare_nonfree_software.setChecked(val) else: self.debug('Could not find ubuntu-drivers on the executable path.') self.set_allow_nonfree(False) def get_use_nonfree(self): from PyQt4.QtCore import Qt return self.prepare_nonfree_software.checkState() == Qt.Checked def plugin_translate(self, lang): PreparePageBase.plugin_translate(self, lang) # gtk does the ${RELEASE} replace for the title in gtk_ui but we do # it per plugin because our title widget is per plugin release = misc.get_release() widgets = ( self.page.prepare_heading_label, self.page.prepare_best_results, self.page.prepare_foss_disclaimer, ) for widget in widgets: text = widget.text() text = text.replace('${RELEASE}', release.name) text = text.replace('Ubuntu', 'Kubuntu') widget.setText(text)
class PageKde(PreparePageBase): plugin_breadcrumb = 'ubiquity/text/breadcrumb_prepare' restricted_package_name = 'kubuntu-restricted-addons' # Not needed for Maui self.page = None return def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox if self.is_automatic: self.page = None return self.controller = controller try: from PyQt4 import uic from PyQt4 import QtGui self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_sufficient_space) self.secureboot_label = self.page.secureboot_label self.disable_secureboot = self.page.disable_secureboot self.password = self.page.password self.verified_password = self.page.verified_password self.password_extra_label = self.page.password_extra_label self.badPassword = self.page.badPassword self.badPassword.setPixmap(QtGui.QPixmap( "/usr/share/icons/oxygen/16x16/status/dialog-warning.png")) # TODO we should set these up and tear them down while on this # page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) self.page.vbox1.addWidget(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception as e: # TODO use an inconsistent state? print('unable to set up power source watch:', e) try: self.prepare_network_connection = StateBox(self.page) self.page.vbox1.addWidget(self.prepare_network_connection) except Exception as e: print('unable to set up network connection watch:', e) except Exception as e: print("Could not create prepare page:", str(e), file=sys.stderr) self.debug('Could not create prepare page: %s', e) self.page = None self.set_using_secureboot(False) self.plugin_widgets = self.page # quick fix for Neon, hide these, work out if the code # should disappear or what should happen self.prepare_sufficient_space.hide() #self.prepare_power_source.hide() #self.prepare_network_connection.hide() self.page.prepare_best_results.hide() # Maui does not need this self.prepare_download_updates.hide() self.prepare_nonfree_software.hide() self.prepare_foss_disclaimer.hide() def show_insufficient_space_page(self, required, free): return def set_using_secureboot(self, secureboot): self.using_secureboot = secureboot self.secureboot_label.setVisible(secureboot) self.disable_secureboot.setVisible(secureboot) self.password.setVisible(secureboot) self.verified_password.setVisible(secureboot) self.password_extra_label.setVisible(secureboot) self.badPassword.hide() if (secureboot): self.password.textChanged.connect(self.verify_password) self.verified_password.textChanged.connect(self.verify_password) # show warning if passwords do not match def verify_password(self): complete = False if self.password.text() == self.verified_password.text(): self.badPassword.hide() complete = True else: self.badPassword.show() if not self.password.text(): complete = False self.controller.allow_go_forward(complete) def get_secureboot_key(self): return str(self.page.password.text()) def enable_download_updates(self, val): self.prepare_download_updates.setEnabled(val) def set_download_updates(self, val): self.prepare_download_updates.setChecked(val) def get_download_updates(self): from PyQt4.QtCore import Qt return self.prepare_download_updates.checkState() == Qt.Checked def set_allow_nonfree(self, allow): if not allow: self.prepare_nonfree_software.setChecked(False) self.prepare_nonfree_software.setVisible(False) self.prepare_foss_disclaimer.setVisible(False) def set_use_nonfree(self, val): if osextras.find_on_path('ubuntu-drivers'): self.prepare_nonfree_software.setChecked(val) else: self.debug('Could not find ubuntu-drivers on the executable path.') self.set_allow_nonfree(False) def get_use_nonfree(self): from PyQt4.QtCore import Qt return self.prepare_nonfree_software.checkState() == Qt.Checked def plugin_translate(self, lang): PreparePageBase.plugin_translate(self, lang) # gtk does the ${RELEASE} replace for the title in gtk_ui but we do # it per plugin because our title widget is per plugin release = misc.get_release() widgets = ( self.page.prepare_heading_label, self.page.prepare_download_updates, ) for widget in widgets: text = widget.text() text = text.replace('${RELEASE}', release.name) text = text.replace('Ubuntu', 'Maui') widget.setText(text)
class PageKde(PreparePageBase): plugin_breadcrumb = 'ubiquity/text/breadcrumb_prepare' restricted_package_name = 'kubuntu-restricted-addons' def __init__(self, controller, *args, **kwargs): from ubiquity.qtwidgets import StateBox self.controller = controller try: from PyQt5 import uic from PyQt5 import QtGui, QtWidgets # No worries, this has nothing to do with NM, we just want the # generic progress indicator from there from ubiquity.frontend.kde_components.nmwidgets import ProgressIndicator self.page = uic.loadUi('/usr/share/ubiquity/qt/stepPrepare.ui') self.prepare_minimal_install = self.page.prepare_minimal_install self.qt_label_minimal_install = self.page.qt_label_minimal_install self.prepare_download_updates = self.page.prepare_download_updates self.prepare_nonfree_software = self.page.prepare_nonfree_software self.prepare_foss_disclaimer = self.page.prepare_foss_disclaimer self.prepare_sufficient_space = StateBox(self.page) self.secureboot_label = self.page.secureboot_label self.disable_secureboot = self.page.disable_secureboot self.password = self.page.password self.verified_password = self.page.verified_password self.password_extra_label = self.page.password_extra_label self.badPassword = self.page.badPassword self.badPassword.setPixmap( QtGui.QPixmap( "/usr/share/icons/oxygen/16x16/status/dialog-warning.png")) self.progress_indicator = ProgressIndicator() self.progress_indicator.hide() layout = QtWidgets.QHBoxLayout(self.page.progress_container) layout.addWidget(self.progress_indicator) # TODO we should set these up and tear them down while on this # page. try: self.prepare_power_source = StateBox(self.page) if upower.has_battery(): upower.setup_power_watch(self.prepare_power_source) else: self.prepare_power_source.hide() except Exception as e: # TODO use an inconsistent state? print('unable to set up power source watch:', e) if not os.path.exists(minimal_install_rlist_path): self.qt_label_minimal_install.hide() self.prepare_minimal_install.hide() try: self.prepare_network_connection = StateBox(self.page) except Exception as e: print('unable to set up network connection watch:', e) except Exception as e: print("Could not create prepare page:", str(e), file=sys.stderr) self.debug('Could not create prepare page: %s', e) self.page = None self.set_using_secureboot(False) self.plugin_widgets = self.page def show_rst_page(self): return False def show_ubuntu_drivers_spinner(self): self.progress_indicator.show() self.progress_indicator.setSpinnerVisible(True) def hide_ubuntu_drivers_spinner(self): self.progress_indicator.setSpinnerVisible(False) self.progress_indicator.hide() def plugin_on_next_clicked(self): if self.get_use_nonfree(): self.show_ubuntu_drivers_spinner() def show_insufficient_space_page(self, required, free): from PyQt5 import QtWidgets QtWidgets.QMessageBox.critical(self.page, free, required) sys.exit(1) return def set_using_secureboot(self, secureboot): self.using_secureboot = secureboot self.secureboot_label.setVisible(secureboot) self.disable_secureboot.setVisible(secureboot) self.password.setVisible(secureboot) self.verified_password.setVisible(secureboot) self.password_extra_label.setVisible(secureboot) self.badPassword.hide() if (secureboot): self.password.textChanged.connect(self.verify_password) self.verified_password.textChanged.connect(self.verify_password) # show warning if passwords do not match def verify_password(self): complete = False if self.password.text() == self.verified_password.text(): self.badPassword.hide() complete = True else: self.badPassword.show() if not self.password.text(): complete = False self.controller.allow_go_forward(complete) def get_secureboot_key(self): return str(self.page.password.text()) def enable_download_updates(self, val): self.prepare_download_updates.setEnabled(val) def set_download_updates(self, val): self.prepare_download_updates.setChecked(val) def get_download_updates(self): from PyQt5.QtCore import Qt return self.prepare_download_updates.checkState() == Qt.Checked def set_minimal_install(self, val): self.prepare_minimal_install.setChecked(val) def get_minimal_install(self): if self.prepare_minimal_install.isChecked(): return True return False def set_allow_nonfree(self, allow): if not allow: self.prepare_nonfree_software.setChecked(False) self.prepare_nonfree_software.setVisible(False) self.prepare_foss_disclaimer.setVisible(False) def set_use_nonfree(self, val): if osextras.find_on_path('ubuntu-drivers'): self.prepare_nonfree_software.setChecked(val) else: self.debug('Could not find ubuntu-drivers on the executable path.') self.set_allow_nonfree(False) def get_use_nonfree(self): from PyQt5.QtCore import Qt return self.prepare_nonfree_software.checkState() == Qt.Checked def plugin_translate(self, lang): PreparePageBase.plugin_translate(self, lang) # Translate the progress label self.progress_indicator.setText( self.controller.get_string('ubiquity/text/preparing_ud_label', lang)) # gtk does the ${RELEASE} replace for the title in gtk_ui but we do # it per plugin because our title widget is per plugin release = misc.get_release() widgets = ( self.page.prepare_heading_label, self.page.prepare_download_updates, ) for widget in widgets: text = widget.text() text = text.replace('${RELEASE}', release.name) text = text.replace('Linux Mint', 'Kubuntu') widget.setText(text)