def start(self): incomplete = [] if self.google_radio.isChecked(): if not self.username.text(): incomplete.append(self.username) if not self.password.text(): incomplete.append(self.password) if not self.document_id.text(): incomplete.append(self.document_id) elif not self.csv_file.text(): incomplete.append(self.csv_file) if not self.dbf_file.text(): incomplete.append(self.dbf_file) if len(incomplete) > 0: mbox = QMessageBox(self) mbox.setWindowTitle("Warning, incomplete fields!") mbox.setIcon(QMessageBox.Warning) mbox.setWindowIcon(QIcon.fromTheme("dialog-warning")) mbox.setText("%d fields are incomplete" % len(incomplete)) mbox.exec() for field in self.changed_styles: field.setStyleSheet("") for field in incomplete: field.setStyleSheet("border: 1.5px solid red; border-radius: 5px") self.changed_styles = incomplete.copy() return for field in self.changed_styles: field.setStyleSheet("") self.setStatusTip("Working...") self.working_thread = WorkThread(self) self.working_thread.finished.connect(self.finished_start) self.working_thread.start()
def finished_start(self): self.save_settings() self.start_button.setText("Start") self.setEnabled(True) self.setStatusTip("Ready") if self.working_thread.mbox: data = self.working_thread.mbox mbox = QMessageBox(self) mbox.setWindowTitle(data[0]) mbox.setIcon(data[1]) mbox.setWindowIcon(data[2]) mbox.setText(data[3]) if data[4]: mbox.setDetailedText(data[4]) mbox.exec() # TODO: NEED TO FIX! if self.working_thread.updates: d = TableDialog(self.working_thread.updates, self.working_thread.streetdb) d.exec() else: mbox = QMessageBox(self) mbox.setWindowTitle("Done!") if self.working_thread.updates: mbox.setText("Program is done! {} updated!" .format(len(self.working_thread.updates))) else: mbox.setText("Program is done! Everything was up to date!") mbox.setIcon(QMessageBox.Information) mbox.exec()
def on_delete_cb(self, feature, subelements): """Respond to delete object event (callback).""" delete = True if self.fpo.Group: # Project is not empty title = translate("Render", "Warning: Deleting Non-Empty Project") msg = translate( "Render", "Project is not empty. " "All its contents will be deleted too.\n\n" "Are you sure you want to continue?", ) box = QMessageBox( QMessageBox.Warning, title, msg, QMessageBox.Yes | QMessageBox.No, ) usr_confirm = box.exec() if usr_confirm == QMessageBox.Yes: subobjs = self.fpo.Proxy.all_views(include_groups=True)[1:] for obj in subobjs: obj.Document.removeObject(obj.Name) else: delete = False return delete