def __init__(self, publish_name, data_manager, parent, **kwargs): super(WaitDialog, self).__init__(parent) self.layout = QGridLayout() self.progress_bar = QCustomProgressBar(self) self.logConsole = QLogConsole() self.action_button = QPushButton("Process") self.quit_button = QPushButton("Exit") self.type = kwargs.pop('type', 'package') if self.type == "package": self.publishThread = PublishThread(publish_name, data_manager, **kwargs) else: self.publishThread = PublishComponentThread( publish_name, data_manager, **kwargs) self.publishThread.progress.connect( self.progress_bar.on_progress_received) self.publishThread.log.connect(self.logConsole.on_log_received) self.publishThread.finished.connect(self.handle_worker) self.action_button.clicked.connect(self.start_action) self.quit_button.clicked.connect(self.close) self.setup_ui()
def __init__(self): super(SplashScreen, self).__init__() self.layout = QGridLayout() self.progressBar = QCustomProgressBar(self) self.urlLabel = QLabel("URL of Aptly :") self.urlEdit = QLineEdit("http://127.0.0.1:8089") self.loadButton = QPushButton("Connect to aptly") self.loadButton.setDefault(True) self.quitButton = QPushButton("Quit") self.dataManager = DataManager() self.logConsole = QLogConsole("") self.setupUI()
class WaitDialog(QDialog): def __init__(self, publish_name, data_manager, parent, **kwargs): super(WaitDialog, self).__init__(parent) self.layout = QGridLayout() self.progress_bar = QCustomProgressBar(self) self.logConsole = QLogConsole() self.action_button = QPushButton("Process") self.quit_button = QPushButton("Exit") self.type = kwargs.pop('type', 'package') if self.type == "package": self.publishThread = PublishThread(publish_name, data_manager, **kwargs) else: self.publishThread = PublishComponentThread( publish_name, data_manager, **kwargs) self.publishThread.progress.connect( self.progress_bar.on_progress_received) self.publishThread.log.connect(self.logConsole.on_log_received) self.publishThread.finished.connect(self.handle_worker) self.action_button.clicked.connect(self.start_action) self.quit_button.clicked.connect(self.close) self.setup_ui() def setup_ui(self): self.setWindowTitle("python-aptly GUI") self.setFixedSize(600, 200) self.setVisible(True) self.setModal(True) self.setLayout(self.layout) self.layout.addWidget(self.action_button) self.layout.addWidget(self.progress_bar) self.layout.addWidget(self.logConsole) self.layout.addWidget(self.quit_button) def start_action(self): self.action_button.setDisabled(True) self.publishThread.start() def handle_worker(self): if self.progress_bar.value() == 100: self.close()
def __init__(self, publish_name, data_manager, parent, **kwargs): super(WaitDialog, self).__init__(parent) self.layout = QGridLayout() self.progress_bar = QCustomProgressBar(self) self.logConsole = QLogConsole() self.type = kwargs.pop('type', 'package') if self.type == "package": self.publishThread = PublishThread(publish_name, data_manager, **kwargs) else: self.publishThread = PublishComponentThread( publish_name, data_manager, **kwargs) self.publishThread.progress.connect( self.progressBar.on_progress_received) self.dataThread.log.connect(self.logConsole.on_log_received) self.setup_ui()
class SplashScreen(QDialog): def __init__(self): super(SplashScreen, self).__init__() self.layout = QGridLayout() self.progressBar = QCustomProgressBar(self) self.urlLabel = QLabel("URL of Aptly :") self.urlEdit = QLineEdit("http://127.0.0.1:8089") self.loadButton = QPushButton("Connect to aptly") self.loadButton.setDefault(True) self.quitButton = QPushButton("Quit") self.dataManager = DataManager() self.logConsole = QLogConsole("") self.setupUI() def load_main_window(self): if not self.dataThread.cancelled: self.setModal(False) self.window = Window(self.dataManager) self.window.show() self.close() def load_publish_connector(self): self.logConsole.info("Initializing connection") self.progressBar.setValue(0) try: self.dataManager.create_client(self.urlEdit.text()) except Exception as e: self.logConsole.error(repr(e)) return self.dataThread = DataThread(self.dataManager) self.dataThread.log.connect(self.logConsole.on_log_received) self.dataThread.progress.connect(self.progressBar.on_progress_received) self.dataThread.start() self.loadButton.disconnect() self.loadButton.setText("Cancel") self.loadButton.clicked.connect(self.abort_load) self.dataThread.finished.connect(self.load_main_window) def abort_load(self): self.dataThread.cancelled = True self.loadButton.setText("Load publish") self.loadButton.disconnect() self.loadButton.clicked.connect(self.load_publish_connector) def setupUI(self): self.setWindowTitle("python-aptly GUI") self.setFixedSize(600, 400) self.setVisible(True) self.setLayout(self.layout) self.layout.addWidget(self.urlLabel) self.layout.addWidget(self.urlEdit) self.layout.addWidget(self.loadButton) self.layout.addWidget(self.progressBar) self.layout.addWidget(self.logConsole) self.layout.addWidget(self.quitButton) self.loadButton.clicked.connect(self.load_publish_connector) self.quitButton.clicked.connect(self.close)