def __init__(self, symbol, isin='', name=''): QDialog.__init__(self) self.setupUi(self) self.asset_id = None self.SymbolEdit.setText(symbol) self.isinEdit.setText(isin) self.NameEdit.setText(name) self.type_model = QSqlTableModel(db=db_connection()) self.type_model.setTable('asset_types') self.type_model.select() self.TypeCombo.setModel(self.type_model) self.TypeCombo.setModelColumn(1) self.data_src_model = QSqlTableModel(db=db_connection()) self.data_src_model.setTable('data_sources') self.data_src_model.select() self.DataSrcCombo.setModel(self.data_src_model) self.DataSrcCombo.setModelColumn(1) # center dialog with respect to main application window parent = None for widget in QApplication.topLevelWidgets(): if widget.objectName() == Setup.MAIN_WND_NAME: parent = widget if parent: x = parent.x() + parent.width() / 2 - self.width() / 2 y = parent.y() + parent.height() / 2 - self.height() / 2 self.setGeometry(x, y, self.width(), self.height())
def __init__(self): self.widgetsList: typing.List[QWidget] = [] self.updateTimer = QTimer(QApplication.topLevelWidgets()[0]) self.updateTimer.timeout.connect(self.TimerUpdate) self.updateTimer.start(1000) self.lastModifiedTime = None self.scriptFilename = "UI/STYLESHEET.css" self.stylesheet = None
def __init__(self, description, current_account, recent_account=None): QDialog.__init__(self) self.setupUi(self) self.account_id = recent_account self.store_account = False self.current_account = current_account self.DescriptionLbl.setText(description) if self.account_id: self.AccountWidget.selected_id = self.account_id # center dialog with respect to main application window parent = None for widget in QApplication.topLevelWidgets(): if widget.objectName() == Setup.MAIN_WND_NAME: parent = widget if parent: x = parent.x() + parent.width() / 2 - self.width() / 2 y = parent.y() + parent.height() / 2 - self.height() / 2 self.setGeometry(x, y, self.width(), self.height())