def __init__(self, file_in, install): QtCore.QThread.__init__(self) self.op_progress = None self.cache = apt.Cache(self.op_progress) self.cache.open() self.file_in = file_in self.isDone = False self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) handler = logging.FileHandler('/var/log/resetter/resetter.log') handler.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(funcName)s - %(levelname)s - %(message)s' ) handler.setFormatter(formatter) self.logger.addHandler(handler) self.install = install self.aprogress = UIAcquireProgress(False) self.thread1 = QtCore.QThread() self.aprogress.moveToThread(self.thread1) self.thread1.started.connect( lambda: self.aprogress.play(0.0, False, "")) self.aprogress.finished.connect(self.thread1.quit) self.iprogress = UIInstallProgress() self.thread2 = QtCore.QThread() self.iprogress.moveToThread(self.thread2) self.thread2.started.connect(lambda: self.iprogress.play(0.0, "")) self.iprogress.finished.connect(self.thread2.quit) self.broken_list = []
def __init__(self, file_in, install): QtCore.QThread.__init__(self) self.cache = apt.Cache(None) self.cache.open() self.file_in = file_in self.install = install self.isDone = False self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) handler = logging.FileHandler('/var/log/resetter/resetter.log') handler.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(funcName)s - %(levelname)s - %(message)s' ) handler.setFormatter(formatter) self.logger.addHandler(handler) self.resolver = apt.cache.ProblemResolver(self.cache) self.aprogress = UIAcquireProgress(False) self.thread1 = QtCore.QThread() self.aprogress.moveToThread(self.thread1) self.thread1.started.connect( lambda: self.aprogress.play(0.0, False, "")) self.aprogress.finished.connect(self.thread1.quit) self.error_msg = QtGui.QMessageBox() self.error_msg.setIcon(QtGui.QMessageBox.Critical) self.error_msg.setWindowTitle("Error") self.thread2 = QtCore.QThread() self.iprogress = UIInstallProgress() self.iprogress.moveToThread(self.thread2) self.thread2.started.connect(lambda: self.iprogress.play(0.0, "")) self.iprogress.finished.connect(self.thread2.quit) self.broken_list = []
def __init__(self, file_in, response, parent=None): super(Apply, self).__init__(parent) self.setMinimumSize(400, 250) self.file_in = file_in self.response = response self.setWindowTitle("Applying") self.error_msg = QtGui.QMessageBox() self.error_msg.setIcon(QtGui.QMessageBox.Critical) self.error_msg.setWindowTitle("Error") self.buttonCancel = QtGui.QPushButton() self.buttonCancel.setText("Cancel") self.buttonCancel.clicked.connect(self.cancel) self.progress = QtGui.QProgressBar(self) self.lbl1 = QtGui.QLabel() gif = os.path.abspath( "/usr/lib/resetter/data/icons/chassingarrows.gif") self.movie = QtGui.QMovie(gif) self.movie.setScaledSize(QtCore.QSize(20, 20)) self.pixmap = QtGui.QPixmap( "/usr/lib/resetter/data/icons/checkmark.png") self.pixmap2 = self.pixmap.scaled(20, 20) verticalLayout = QtGui.QVBoxLayout(self) verticalLayout.addWidget(self.lbl1) verticalLayout.addWidget(self.progress) gridLayout = QtGui.QGridLayout() self.labels = {} for i in range(1, 6): for j in range(1, 3): self.labels[(i, j)] = QtGui.QLabel() self.labels[(i, j)].setMinimumHeight(20) gridLayout.addWidget(self.labels[(i, j)], i, j) gridLayout.setAlignment(QtCore.Qt.AlignCenter) self.labels[(1, 2)].setText("Loading Apps") self.labels[(2, 2)].setText("Removing Apps") self.labels[(3, 2)].setText("Deleting Users") self.labels[(4, 2)].setText("Cleaning Up") if self.response: self.labels[(5, 2)].setText("Removing old kernels") verticalLayout.addSpacing(20) verticalLayout.addLayout(gridLayout) verticalLayout.addWidget(self.buttonCancel, 0, QtCore.Qt.AlignRight) self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) handler = logging.FileHandler('/var/log/resetter/resetter.log') handler.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(funcName)s - %(levelname)s - %(message)s' ) handler.setFormatter(formatter) self.logger.addHandler(handler) self.progressView = ProgressThread(self.file_in) self.account = AccountDialog(self) self.connect(self.progressView, QtCore.SIGNAL("updateProgressBar(int, bool)"), self.updateProgressBar) self._cache = self.progressView._cache self.aprogress = UIAcquireProgress(self.progress, self.lbl1) self.iprogress = UIInstallProgress(self.progress, self.lbl1) self.addUser()
def __init__(self, f_name, action, answer): self.win = None self.screen = curses.initscr() self.aprogress = UIAcquireProgress(6) self.iprogress = UIInstallProgress(6) self.answer = answer self.cache = apt.Cache(None) self.cache.open() self.percent = '' self.load(f_name, action)
def __init__(self, file_in, action, action_type, parent=None): super(Install, self).__init__(parent) self.setMinimumSize(305, 100) self.file_in = file_in self.setWindowTitle("Working...") self.error_msg = QtGui.QMessageBox() self.error_msg.setIcon(QtGui.QMessageBox.Critical) self.error_msg.setWindowTitle("Error") self.buttonCancel = QtGui.QPushButton() self.buttonCancel.setText("Cancel") self.buttonCancel.clicked.connect(self.cancel) self.progress = QtGui.QProgressBar(self) self.lbl1 = QtGui.QLabel() gif = os.path.abspath( "/usr/lib/resetter/data/icons/chassingarrows.gif") self.movie = QtGui.QMovie(gif) self.movie.setScaledSize(QtCore.QSize(20, 20)) self.pixmap = QtGui.QPixmap( "/usr/lib/resetter/data/icons/checkmark.png") self.pixmap2 = self.pixmap.scaled(20, 20) verticalLayout = QtGui.QVBoxLayout(self) verticalLayout.addWidget(self.lbl1) verticalLayout.addWidget(self.progress) gridLayout = QtGui.QGridLayout() self.labels = {} for i in range(1, 3): for j in range(1, 3): self.labels[(i, j)] = QtGui.QLabel() self.labels[(i, j)].setMinimumHeight(20) gridLayout.addWidget(self.labels[(i, j)], i, j) gridLayout.setAlignment(QtCore.Qt.AlignCenter) self.labels[(1, 2)].setText("Loading packages") self.labels[(2, 2)].setText(action) verticalLayout.addSpacing(20) verticalLayout.addLayout(gridLayout) verticalLayout.addWidget(self.buttonCancel, 0, QtCore.Qt.AlignRight) self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.DEBUG) handler = logging.FileHandler('/var/log/resetter/resetter.log') handler.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(funcName)s - %(levelname)s - %(message)s' ) handler.setFormatter(formatter) self.logger.addHandler(handler) self.installProgress = ProgressThread(file_in, action_type) self.connect(self.installProgress, QtCore.SIGNAL("updateProgressBar(int, bool)"), self.updateProgressBar) self.install_cache = self.installProgress._cache self.aprogress = UIAcquireProgress(self.progress, self.lbl1, False) self.iprogress = UIInstallProgress(self.progress, self.lbl1) self.start()
def __init__(self, f_name, action, answer): self.directory = ".resetter-cli/data" self.user = os.environ['SUDO_USER'] working_dir = '/home/{}'.format(self.user) os.chdir(working_dir) if os.path.isdir(self.directory): os.chdir(self.directory) self.win = None #self.screen = curses.initscr() self.aprogress = UIAcquireProgress(8) self.iprogress = UIInstallProgress(8) self.answer = answer self.cache = apt.Cache(None) self.cache.open() self.percent = '' self.load(f_name, action)