def setupUi(self, MainWindow): lbMinWidth = 65 # leMinWidth = 200 MainWindow.setObjectName("MainWindow") MainWindow.resize(400, 310) # self.centralwidget = QWidget(MainWindow) self.mainSplitter = QSplitter(Qt.Horizontal, MainWindow) self.mainSplitter.setObjectName("centralwidget") self.mainSplitter.setProperty("childrenCollapsible", False) MainWindow.setCentralWidget(self.mainSplitter) self.leftSplitter = QSplitter(Qt.Vertical, self.mainSplitter) self.leftSplitter.setProperty("childrenCollapsible", False) ##### login_gbox self.login_gbox = QGroupBox(self.leftSplitter) self.login_gbox.setFlat(True) self.login_gbox.setObjectName("login_gbox") login_gbox_layout = QVBoxLayout(self.login_gbox) login_gbox_csf_layout = QHBoxLayout() login_gbox_account_layout = QHBoxLayout() login_gbox_connect_layout = QHBoxLayout() login_gbox_layout.addLayout(login_gbox_csf_layout) login_gbox_layout.addLayout(login_gbox_account_layout) login_gbox_layout.addLayout(login_gbox_connect_layout) self.lb_client_secrets_file_path = QLabel(self.login_gbox) self.lb_client_secrets_file_path.setObjectName("lb_client_secrets_file_path") self.lb_client_secrets_file_path.setMinimumWidth(lbMinWidth) self.client_secrets_file_path_le = QLineEdit(self.login_gbox) self.client_secrets_file_path_le.setObjectName("client_secrets_file_path_le") self.client_secret_file_path_tBtn = QToolButton(self.login_gbox) self.client_secret_file_path_tBtn.setObjectName("client_secret_file_path_tBtn") login_gbox_csf_layout.addWidget(self.lb_client_secrets_file_path) login_gbox_csf_layout.addWidget(self.client_secrets_file_path_le) login_gbox_csf_layout.addWidget(self.client_secret_file_path_tBtn) self.lb_account = QLabel(self.login_gbox) self.lb_account.setMaximumWidth(lbMinWidth) self.lb_account.setObjectName("lb_account") self.remove_account_btn = QToolButton(self.login_gbox) self.remove_account_btn.setObjectName("remove_account_btn") self.remove_account_btn.setMinimumWidth(20) self.remove_account_btn.setEnabled(False) self.add_account_btn = QToolButton(self.login_gbox) self.add_account_btn.setObjectName("add_account_btn") self.add_account_btn.setMinimumWidth(20) self.accounts_cb = QComboBox(self.login_gbox) self.accounts_cb.setObjectName("accounts_cb") login_gbox_account_layout.addWidget(self.lb_account) login_gbox_account_layout.addWidget(self.remove_account_btn) login_gbox_account_layout.addWidget(self.add_account_btn) login_gbox_account_layout.addWidget(self.accounts_cb) self.lb_decryption_key = QLabel(self.login_gbox) self.lb_decryption_key.setObjectName("lb_decryption_key") self.lb_decryption_key.setMinimumWidth(lbMinWidth) self.lb_decryption_key.hide() self.decryption_key_le = QLineEdit(self.login_gbox) self.decryption_key_le.setEchoMode(QLineEdit.Password) self.decryption_key_le.setObjectName("decryption_key_le") self.decryption_key_le.hide() self.connect_btn = QPushButton(self.login_gbox) self.connect_btn.setEnabled(False) self.connect_btn.setObjectName("connect_btn") login_gbox_connect_layout.addWidget(self.lb_decryption_key) login_gbox_connect_layout.addWidget(self.decryption_key_le) login_gbox_connect_layout.addWidget(self.connect_btn) #### search_gbox self.search_gbox = QGroupBox(self.leftSplitter) self.search_gbox.setFlat(True) self.search_gbox.setObjectName("search_gbox") self.search_gbox.hide() search_gbox_layout = QVBoxLayout(self.search_gbox) search_gbox_mailbox_layout = QVBoxLayout() search_gbox_date_layout = QHBoxLayout() search_gbox_from_layout = QHBoxLayout() search_gbox_to_layout = QHBoxLayout() search_gbox_subject_layout = QHBoxLayout() search_gbox_threads_layout = QHBoxLayout() search_gbox_paramaters_layout = QHBoxLayout() search_gbox_layout.addLayout(search_gbox_mailbox_layout) search_gbox_layout.addLayout(search_gbox_date_layout) search_gbox_layout.addLayout(search_gbox_from_layout) search_gbox_layout.addLayout(search_gbox_to_layout) search_gbox_layout.addLayout(search_gbox_subject_layout) search_gbox_layout.addLayout(search_gbox_threads_layout) search_gbox_layout.addLayout(search_gbox_paramaters_layout) self.lb_select_mailbox = QLabel(self.search_gbox) self.lb_select_mailbox.setObjectName("lb_select_mailbox") self.mailboxes_lw = QListWidget(self.search_gbox) self.mailboxes_lw.setEditTriggers(QAbstractItemView.NoEditTriggers) self.mailboxes_lw.setSelectionMode(QAbstractItemView.ExtendedSelection) self.mailboxes_lw.setObjectName("mailboxes_lw") search_gbox_mailbox_layout.addWidget(self.lb_select_mailbox) search_gbox_mailbox_layout.addWidget(self.mailboxes_lw) self.after_date_cb = QCheckBox(self.search_gbox) self.after_date_cb.setObjectName("after_date_cb") self.after_date_cb.setMinimumWidth(lbMinWidth) self.after_date_cb.setMaximumWidth(lbMinWidth) self.after_date_edit = QDateEdit(self.search_gbox) self.after_date_edit.setCalendarPopup(True) self.after_date_edit.setObjectName("after_date_edit") self.after_date_edit.setDate(QDate.currentDate().addDays(-365)) self.after_date_edit.setMaximumDate(QDate.currentDate()) self.after_date_edit.setEnabled(False) self.before_date_cb = QCheckBox(self.search_gbox) self.before_date_cb.setObjectName("before_date_cb") self.before_date_cb.setMinimumWidth(70) self.before_date_cb.setMaximumWidth(70) self.before_date_edit = QDateEdit(self.search_gbox) self.before_date_edit.setCalendarPopup(True) self.before_date_edit.setObjectName("before_date_edit") self.before_date_edit.setDate(QDate.currentDate()) self.before_date_edit.setMaximumDate(QDate.currentDate()) self.before_date_edit.setEnabled(False) search_gbox_date_layout.addWidget(self.after_date_cb) search_gbox_date_layout.addWidget(self.after_date_edit) search_gbox_date_layout.addWidget(self.before_date_cb) search_gbox_date_layout.addWidget(self.before_date_edit) self.lb_from = QLabel(self.search_gbox) self.lb_from.setObjectName("lb_from") self.lb_from.setMinimumWidth(lbMinWidth) self.from_le = QLineEdit(self.search_gbox) self.from_le.setObjectName("from_le") search_gbox_from_layout.addWidget(self.lb_from) search_gbox_from_layout.addWidget(self.from_le) self.lb_to = QLabel(self.search_gbox) self.lb_to.setObjectName("lb_to") self.lb_to.setMinimumWidth(lbMinWidth) self.to_le = QLineEdit(self.search_gbox) self.to_le.setObjectName("to_le") search_gbox_to_layout.addWidget(self.lb_to) search_gbox_to_layout.addWidget(self.to_le) self.lb_subject = QLabel(self.search_gbox) self.lb_subject.setObjectName("lb_subject") self.lb_subject.setMinimumWidth(lbMinWidth) self.subject_le = QLineEdit(self.search_gbox) self.subject_le.setObjectName("subject_le") search_gbox_subject_layout.addWidget(self.lb_subject) search_gbox_subject_layout.addWidget(self.subject_le) self.lb_threads = QLabel(self.search_gbox) self.lb_threads.setObjectName("lb_threads") self.lb_threads.setMaximumWidth(lbMinWidth) self.thread_count_sb = QSpinBox(self.search_gbox) self.thread_count_sb.setMinimum(1) self.thread_count_sb.setMaximum(10) self.thread_count_sb.setObjectName("thread_count_sb") self.html_radio = QRadioButton(self.search_gbox) self.html_radio.setObjectName("html_radio") self.text_radio = QRadioButton(self.search_gbox) self.text_radio.setObjectName("text_radio") self.extactTypeButtonGroup = QButtonGroup(self) self.extactTypeButtonGroup.addButton(self.html_radio) self.extactTypeButtonGroup.addButton(self.text_radio) self.html_radio.setChecked(True) self.search_btn = QPushButton(self.search_gbox) self.search_btn.setObjectName("search_btn") search_gbox_threads_layout.addWidget(self.lb_threads) search_gbox_threads_layout.addWidget(self.thread_count_sb) search_gbox_threads_layout.addWidget(self.html_radio) search_gbox_threads_layout.addWidget(self.text_radio) search_gbox_threads_layout.addWidget(self.search_btn) self.parameters_cb = QCheckBox(self.search_gbox) self.parameters_cb.setText("") self.parameters_cb.setObjectName("parameters_cb") self.parameters_le = QLineEdit(self.search_gbox) self.parameters_le.setEnabled(False) self.parameters_le.setObjectName("parameters_le") search_gbox_paramaters_layout.addWidget(self.parameters_cb) search_gbox_paramaters_layout.addWidget(self.parameters_le) #### log_gbox self.log_gbox = QGroupBox(self.leftSplitter) self.log_gbox.setFlat(True) self.log_gbox.setObjectName("log_gbox") log_layout = QVBoxLayout(self.log_gbox) self.log_te = QTextEdit(self.log_gbox) self.log_te.setLineWrapMode(QTextEdit.NoWrap) self.log_te.setReadOnly(True) self.log_te.setTextInteractionFlags(Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse) self.log_te.setObjectName("log_te") self.disconnect_btn = QPushButton(self.log_gbox) self.disconnect_btn.setObjectName("disconnect_btn") self.disconnect_btn.hide() log_layout.addWidget(self.log_te) log_layout_btn = QHBoxLayout() log_layout.addLayout(log_layout_btn) log_layout_btn.addWidget(self.disconnect_btn) log_layout_btn.addStretch() #### links_gbox self.links_gbox = QGroupBox(self.mainSplitter) self.links_gbox.setFlat(True) self.links_gbox.setObjectName("links_gbox") self.links_gbox.hide() links_gbox_layout = QVBoxLayout(self.links_gbox) links_gbox_links_layout = QVBoxLayout() links_gbox_buttons_layout = QHBoxLayout() links_gbox_layout.addLayout(links_gbox_links_layout) links_gbox_layout.addLayout(links_gbox_buttons_layout) self.links_text_edit = QTextEdit(self.links_gbox) self.links_text_edit.setObjectName("links_text_edit") links_gbox_links_layout.addWidget(self.links_text_edit) self.export_txt_btn = QPushButton(self.links_gbox) self.export_txt_btn.setObjectName("export_txt_btn") self.export_txt_btn.setEnabled(False) self.export_html_btn = QPushButton(self.links_gbox) self.export_html_btn.setObjectName("export_html_btn") self.export_html_btn.setEnabled(False) links_gbox_buttons_layout.addWidget(self.export_txt_btn) links_gbox_buttons_layout.addWidget(self.export_html_btn) ### menubar self.menubar = QMenuBar(MainWindow) # self.menubar.setGeometry(QRect(0, 0, 860, 21)) self.menubar.setObjectName("menubar") self.menu_file = QMenu(self.menubar) self.menu_file.setObjectName("menu_file") self.menu_help = QMenu(self.menubar) self.menu_help.setObjectName("menu_help") MainWindow.setMenuBar(self.menubar) self.action_about = QAction(MainWindow) self.action_about.setObjectName("action_about") self.action_About_Qt = QAction(MainWindow) self.action_About_Qt.setObjectName("action_About_Qt") self.action_exit = QAction(MainWindow) self.action_exit.setObjectName("action_exit") self.actionSave = QAction(MainWindow) self.actionSave.setObjectName("actionSave") self.action_Gmail_Advanced_Search_Syntax = QAction(MainWindow) self.action_Gmail_Advanced_Search_Syntax.setObjectName("action_Gmail_Advanced_Search_Syntax") self.menu_file.addAction(self.action_exit) self.menu_help.addAction(self.action_Gmail_Advanced_Search_Syntax) self.menu_help.addSeparator() self.menu_help.addAction(self.action_about) self.menu_help.addAction(self.action_About_Qt) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.client_secrets_file_path_le, self.client_secret_file_path_tBtn) MainWindow.setTabOrder(self.client_secret_file_path_tBtn, self.remove_account_btn) MainWindow.setTabOrder(self.remove_account_btn, self.add_account_btn) MainWindow.setTabOrder(self.add_account_btn, self.accounts_cb) MainWindow.setTabOrder(self.decryption_key_le, self.connect_btn) MainWindow.setTabOrder(self.connect_btn, self.log_te) MainWindow.setTabOrder(self.log_te, self.mailboxes_lw) MainWindow.setTabOrder(self.mailboxes_lw, self.after_date_cb) MainWindow.setTabOrder(self.after_date_cb, self.after_date_edit) MainWindow.setTabOrder(self.after_date_edit, self.before_date_cb) MainWindow.setTabOrder(self.before_date_cb, self.before_date_edit) MainWindow.setTabOrder(self.before_date_edit, self.from_le) MainWindow.setTabOrder(self.from_le, self.to_le) MainWindow.setTabOrder(self.to_le, self.subject_le) MainWindow.setTabOrder(self.subject_le, self.thread_count_sb) MainWindow.setTabOrder(self.thread_count_sb, self.html_radio) MainWindow.setTabOrder(self.html_radio, self.text_radio) MainWindow.setTabOrder(self.text_radio, self.search_btn) MainWindow.setTabOrder(self.search_btn, self.parameters_cb) MainWindow.setTabOrder(self.parameters_cb, self.parameters_le) MainWindow.setTabOrder(self.parameters_le, self.disconnect_btn) MainWindow.setTabOrder(self.disconnect_btn, self.links_text_edit) MainWindow.setTabOrder(self.links_text_edit, self.export_txt_btn) MainWindow.setTabOrder(self.export_txt_btn, self.export_html_btn) MainWindow.setTabOrder(self.export_html_btn, self.mailboxes_lw)
def __init__(self): QWidget.__init__(self) self.setGeometry(QRect(100, 100, 400, 200)) self.layout = QtGui.QGridLayout(self) #lblAssetType self.lblAssetType = QLabel("Asset Type") self.layout.addWidget(self.lblAssetType, 0, 0) #cmdAssetType self.cmdAssetType = QComboBox(self) self.cmdAssetType.addItems(DaoAsset().getAssetTypes()) self.layout.addWidget(self.cmdAssetType, 0, 1) #lblAssetName self.lblAssetName = QLabel("Asset Name") self.layout.addWidget(self.lblAssetName, 1, 0) #cmdAssetName self.cmdAssetName = QComboBox(self) self.layout.addWidget(self.cmdAssetName, 1, 1) #lblCustody self.lblCustody = QLabel("Custody") self.layout.addWidget(self.lblCustody, 2, 0) #cmbCustody self.cmbCustody = QComboBox(self) custodyList = DaoCustody().getCustodyList() for (row) in custodyList: self.cmbCustody.addItem(row[1], row[0]) self.layout.addWidget(self.cmbCustody, 2, 1) #lblBuySell self.lblBuySell = QLabel("Buy Sell") self.layout.addWidget(self.lblBuySell, 3, 0) #cmdBuySell self.cmdBuySell = QComboBox(self) self.cmdBuySell.addItem("BUY") self.cmdBuySell.addItem("SELL") self.layout.addWidget(self.cmdBuySell, 3, 1) #lblByAmount self.lblByAmount = QLabel("By Amount") self.layout.addWidget(self.lblByAmount, 4, 0) #chkByAmount self.chkByAmount = QCheckBox(self) self.layout.addWidget(self.chkByAmount, 4, 1) #lblGrossAmount self.lblGrossAmount = QLabel("Gross Amount") self.layout.addWidget(self.lblGrossAmount, 5, 0) #txtGrossAmount self.txtGrossAmount = QLineEdit(self) self.txtGrossAmount.setValidator(QDoubleValidator( 0, 99999999, 6, self)) self.layout.addWidget(self.txtGrossAmount, 5, 1) #lblAcquisitionDate self.lblAcquisitionDate = QLabel("Acquisition Date") self.layout.addWidget(self.lblAcquisitionDate, 6, 0) #cmdAcquisitionDate self.dateAcquisitionDate = QDateEdit(self) self.dateAcquisitionDate.setDisplayFormat("dd-MM-yyyy") self.dateAcquisitionDate.setDate(datetime.datetime.now()) self.layout.addWidget(self.dateAcquisitionDate, 6, 1) #lblQuantity self.lblQuantity = QLabel("Quantity") self.layout.addWidget(self.lblQuantity, 7, 0) #txtQuantity self.txtQuantity = QLineEdit(self) self.txtQuantity.setValidator(QIntValidator(0, 1000000000, self)) self.layout.addWidget(self.txtQuantity, 7, 1) #lblPrice self.lblPrice = QLabel("Price") self.layout.addWidget(self.lblPrice, 8, 0) #txtPrice self.txtPrice = QLineEdit(self) self.txtPrice.setValidator(QDoubleValidator(0, 99999999, 6, self)) self.layout.addWidget(self.txtPrice, 8, 1) #lblRate self.lblRate = QLabel("Rate") self.layout.addWidget(self.lblRate, 9, 0) #txtRate self.txtRate = QLineEdit(self) self.txtRate.setValidator(QDoubleValidator(0, 99999999, 4, self)) self.txtRate.setEnabled(0) self.layout.addWidget(self.txtRate, 9, 1) #lblNetAmount self.lblNetAmount = QLabel("Net Amount") self.layout.addWidget(self.lblNetAmount, 10, 0) #txtNetAmount self.txtNetAmount = QLineEdit(self) self.txtNetAmount.setEnabled(0) self.txtNetAmount.setValidator(QDoubleValidator(0, 99999999, 6, self)) self.layout.addWidget(self.txtNetAmount, 10, 1) #lblCommissionPercentage self.lblCommissionPercentage = QLabel("Commission Percentage") self.layout.addWidget(self.lblCommissionPercentage, 11, 0) #txtCommissionPercentage self.txtCommissionPercentage = QLineEdit(self) self.txtCommissionPercentage.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionPercentage, 11, 1) #lblCommissionAmount self.lblCommissionAmount = QLabel("Commission Amount") self.layout.addWidget(self.lblCommissionAmount, 12, 0) #txtCommissionAmmount self.txtCommissionAmount = QLineEdit(self) self.txtCommissionAmount.setEnabled(0) self.txtCommissionAmount.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionAmount, 12, 1) #lblCommissionAmount self.lblCommissionVATAmount = QLabel("Commission VAT Amount") self.layout.addWidget(self.lblCommissionVATAmount, 13, 0) #txtCommissionAmmount self.txtCommissionVATAmount = QLineEdit(self) self.txtCommissionVATAmount.setEnabled(0) self.txtCommissionVATAmount.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionVATAmount, 13, 1) #lblTenor self.lblTenor = QLabel("Tenor") self.layout.addWidget(self.lblTenor, 14, 0) #txtTenor self.txtTenor = QLineEdit(self) self.txtTenor.setEnabled(0) self.txtTenor.setValidator(QDoubleValidator(0, 9999999, 0, self)) self.layout.addWidget(self.txtTenor, 14, 1) #btnAdd self.btnAdd = QPushButton("Add", self) self.layout.addWidget(self.btnAdd) #btnClear self.btnClear = QPushButton("Clear", self) self.layout.addWidget(self.btnClear) #clearEditor self.clearEditor() self.initListener()
class Ui_MainWindow(object): def setupUi(self, MainWindow): lbMinWidth = 65 # leMinWidth = 200 MainWindow.setObjectName("MainWindow") MainWindow.resize(400, 310) # self.centralwidget = QWidget(MainWindow) self.mainSplitter = QSplitter(Qt.Horizontal, MainWindow) self.mainSplitter.setObjectName("centralwidget") self.mainSplitter.setProperty("childrenCollapsible", False) MainWindow.setCentralWidget(self.mainSplitter) self.leftSplitter = QSplitter(Qt.Vertical, self.mainSplitter) self.leftSplitter.setProperty("childrenCollapsible", False) ##### login_gbox self.login_gbox = QGroupBox(self.leftSplitter) self.login_gbox.setFlat(True) self.login_gbox.setObjectName("login_gbox") login_gbox_layout = QVBoxLayout(self.login_gbox) login_gbox_csf_layout = QHBoxLayout() login_gbox_account_layout = QHBoxLayout() login_gbox_connect_layout = QHBoxLayout() login_gbox_layout.addLayout(login_gbox_csf_layout) login_gbox_layout.addLayout(login_gbox_account_layout) login_gbox_layout.addLayout(login_gbox_connect_layout) self.lb_client_secrets_file_path = QLabel(self.login_gbox) self.lb_client_secrets_file_path.setObjectName("lb_client_secrets_file_path") self.lb_client_secrets_file_path.setMinimumWidth(lbMinWidth) self.client_secrets_file_path_le = QLineEdit(self.login_gbox) self.client_secrets_file_path_le.setObjectName("client_secrets_file_path_le") self.client_secret_file_path_tBtn = QToolButton(self.login_gbox) self.client_secret_file_path_tBtn.setObjectName("client_secret_file_path_tBtn") login_gbox_csf_layout.addWidget(self.lb_client_secrets_file_path) login_gbox_csf_layout.addWidget(self.client_secrets_file_path_le) login_gbox_csf_layout.addWidget(self.client_secret_file_path_tBtn) self.lb_account = QLabel(self.login_gbox) self.lb_account.setMaximumWidth(lbMinWidth) self.lb_account.setObjectName("lb_account") self.remove_account_btn = QToolButton(self.login_gbox) self.remove_account_btn.setObjectName("remove_account_btn") self.remove_account_btn.setMinimumWidth(20) self.remove_account_btn.setEnabled(False) self.add_account_btn = QToolButton(self.login_gbox) self.add_account_btn.setObjectName("add_account_btn") self.add_account_btn.setMinimumWidth(20) self.accounts_cb = QComboBox(self.login_gbox) self.accounts_cb.setObjectName("accounts_cb") login_gbox_account_layout.addWidget(self.lb_account) login_gbox_account_layout.addWidget(self.remove_account_btn) login_gbox_account_layout.addWidget(self.add_account_btn) login_gbox_account_layout.addWidget(self.accounts_cb) self.lb_decryption_key = QLabel(self.login_gbox) self.lb_decryption_key.setObjectName("lb_decryption_key") self.lb_decryption_key.setMinimumWidth(lbMinWidth) self.lb_decryption_key.hide() self.decryption_key_le = QLineEdit(self.login_gbox) self.decryption_key_le.setEchoMode(QLineEdit.Password) self.decryption_key_le.setObjectName("decryption_key_le") self.decryption_key_le.hide() self.connect_btn = QPushButton(self.login_gbox) self.connect_btn.setEnabled(False) self.connect_btn.setObjectName("connect_btn") login_gbox_connect_layout.addWidget(self.lb_decryption_key) login_gbox_connect_layout.addWidget(self.decryption_key_le) login_gbox_connect_layout.addWidget(self.connect_btn) #### search_gbox self.search_gbox = QGroupBox(self.leftSplitter) self.search_gbox.setFlat(True) self.search_gbox.setObjectName("search_gbox") self.search_gbox.hide() search_gbox_layout = QVBoxLayout(self.search_gbox) search_gbox_mailbox_layout = QVBoxLayout() search_gbox_date_layout = QHBoxLayout() search_gbox_from_layout = QHBoxLayout() search_gbox_to_layout = QHBoxLayout() search_gbox_subject_layout = QHBoxLayout() search_gbox_threads_layout = QHBoxLayout() search_gbox_paramaters_layout = QHBoxLayout() search_gbox_layout.addLayout(search_gbox_mailbox_layout) search_gbox_layout.addLayout(search_gbox_date_layout) search_gbox_layout.addLayout(search_gbox_from_layout) search_gbox_layout.addLayout(search_gbox_to_layout) search_gbox_layout.addLayout(search_gbox_subject_layout) search_gbox_layout.addLayout(search_gbox_threads_layout) search_gbox_layout.addLayout(search_gbox_paramaters_layout) self.lb_select_mailbox = QLabel(self.search_gbox) self.lb_select_mailbox.setObjectName("lb_select_mailbox") self.mailboxes_lw = QListWidget(self.search_gbox) self.mailboxes_lw.setEditTriggers(QAbstractItemView.NoEditTriggers) self.mailboxes_lw.setSelectionMode(QAbstractItemView.ExtendedSelection) self.mailboxes_lw.setObjectName("mailboxes_lw") search_gbox_mailbox_layout.addWidget(self.lb_select_mailbox) search_gbox_mailbox_layout.addWidget(self.mailboxes_lw) self.after_date_cb = QCheckBox(self.search_gbox) self.after_date_cb.setObjectName("after_date_cb") self.after_date_cb.setMinimumWidth(lbMinWidth) self.after_date_cb.setMaximumWidth(lbMinWidth) self.after_date_edit = QDateEdit(self.search_gbox) self.after_date_edit.setCalendarPopup(True) self.after_date_edit.setObjectName("after_date_edit") self.after_date_edit.setDate(QDate.currentDate().addDays(-365)) self.after_date_edit.setMaximumDate(QDate.currentDate()) self.after_date_edit.setEnabled(False) self.before_date_cb = QCheckBox(self.search_gbox) self.before_date_cb.setObjectName("before_date_cb") self.before_date_cb.setMinimumWidth(70) self.before_date_cb.setMaximumWidth(70) self.before_date_edit = QDateEdit(self.search_gbox) self.before_date_edit.setCalendarPopup(True) self.before_date_edit.setObjectName("before_date_edit") self.before_date_edit.setDate(QDate.currentDate()) self.before_date_edit.setMaximumDate(QDate.currentDate()) self.before_date_edit.setEnabled(False) search_gbox_date_layout.addWidget(self.after_date_cb) search_gbox_date_layout.addWidget(self.after_date_edit) search_gbox_date_layout.addWidget(self.before_date_cb) search_gbox_date_layout.addWidget(self.before_date_edit) self.lb_from = QLabel(self.search_gbox) self.lb_from.setObjectName("lb_from") self.lb_from.setMinimumWidth(lbMinWidth) self.from_le = QLineEdit(self.search_gbox) self.from_le.setObjectName("from_le") search_gbox_from_layout.addWidget(self.lb_from) search_gbox_from_layout.addWidget(self.from_le) self.lb_to = QLabel(self.search_gbox) self.lb_to.setObjectName("lb_to") self.lb_to.setMinimumWidth(lbMinWidth) self.to_le = QLineEdit(self.search_gbox) self.to_le.setObjectName("to_le") search_gbox_to_layout.addWidget(self.lb_to) search_gbox_to_layout.addWidget(self.to_le) self.lb_subject = QLabel(self.search_gbox) self.lb_subject.setObjectName("lb_subject") self.lb_subject.setMinimumWidth(lbMinWidth) self.subject_le = QLineEdit(self.search_gbox) self.subject_le.setObjectName("subject_le") search_gbox_subject_layout.addWidget(self.lb_subject) search_gbox_subject_layout.addWidget(self.subject_le) self.lb_threads = QLabel(self.search_gbox) self.lb_threads.setObjectName("lb_threads") self.lb_threads.setMaximumWidth(lbMinWidth) self.thread_count_sb = QSpinBox(self.search_gbox) self.thread_count_sb.setMinimum(1) self.thread_count_sb.setMaximum(10) self.thread_count_sb.setObjectName("thread_count_sb") self.html_radio = QRadioButton(self.search_gbox) self.html_radio.setObjectName("html_radio") self.text_radio = QRadioButton(self.search_gbox) self.text_radio.setObjectName("text_radio") self.extactTypeButtonGroup = QButtonGroup(self) self.extactTypeButtonGroup.addButton(self.html_radio) self.extactTypeButtonGroup.addButton(self.text_radio) self.html_radio.setChecked(True) self.search_btn = QPushButton(self.search_gbox) self.search_btn.setObjectName("search_btn") search_gbox_threads_layout.addWidget(self.lb_threads) search_gbox_threads_layout.addWidget(self.thread_count_sb) search_gbox_threads_layout.addWidget(self.html_radio) search_gbox_threads_layout.addWidget(self.text_radio) search_gbox_threads_layout.addWidget(self.search_btn) self.parameters_cb = QCheckBox(self.search_gbox) self.parameters_cb.setText("") self.parameters_cb.setObjectName("parameters_cb") self.parameters_le = QLineEdit(self.search_gbox) self.parameters_le.setEnabled(False) self.parameters_le.setObjectName("parameters_le") search_gbox_paramaters_layout.addWidget(self.parameters_cb) search_gbox_paramaters_layout.addWidget(self.parameters_le) #### log_gbox self.log_gbox = QGroupBox(self.leftSplitter) self.log_gbox.setFlat(True) self.log_gbox.setObjectName("log_gbox") log_layout = QVBoxLayout(self.log_gbox) self.log_te = QTextEdit(self.log_gbox) self.log_te.setLineWrapMode(QTextEdit.NoWrap) self.log_te.setReadOnly(True) self.log_te.setTextInteractionFlags(Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse) self.log_te.setObjectName("log_te") self.disconnect_btn = QPushButton(self.log_gbox) self.disconnect_btn.setObjectName("disconnect_btn") self.disconnect_btn.hide() log_layout.addWidget(self.log_te) log_layout_btn = QHBoxLayout() log_layout.addLayout(log_layout_btn) log_layout_btn.addWidget(self.disconnect_btn) log_layout_btn.addStretch() #### links_gbox self.links_gbox = QGroupBox(self.mainSplitter) self.links_gbox.setFlat(True) self.links_gbox.setObjectName("links_gbox") self.links_gbox.hide() links_gbox_layout = QVBoxLayout(self.links_gbox) links_gbox_links_layout = QVBoxLayout() links_gbox_buttons_layout = QHBoxLayout() links_gbox_layout.addLayout(links_gbox_links_layout) links_gbox_layout.addLayout(links_gbox_buttons_layout) self.links_text_edit = QTextEdit(self.links_gbox) self.links_text_edit.setObjectName("links_text_edit") links_gbox_links_layout.addWidget(self.links_text_edit) self.export_txt_btn = QPushButton(self.links_gbox) self.export_txt_btn.setObjectName("export_txt_btn") self.export_txt_btn.setEnabled(False) self.export_html_btn = QPushButton(self.links_gbox) self.export_html_btn.setObjectName("export_html_btn") self.export_html_btn.setEnabled(False) links_gbox_buttons_layout.addWidget(self.export_txt_btn) links_gbox_buttons_layout.addWidget(self.export_html_btn) ### menubar self.menubar = QMenuBar(MainWindow) # self.menubar.setGeometry(QRect(0, 0, 860, 21)) self.menubar.setObjectName("menubar") self.menu_file = QMenu(self.menubar) self.menu_file.setObjectName("menu_file") self.menu_help = QMenu(self.menubar) self.menu_help.setObjectName("menu_help") MainWindow.setMenuBar(self.menubar) self.action_about = QAction(MainWindow) self.action_about.setObjectName("action_about") self.action_About_Qt = QAction(MainWindow) self.action_About_Qt.setObjectName("action_About_Qt") self.action_exit = QAction(MainWindow) self.action_exit.setObjectName("action_exit") self.actionSave = QAction(MainWindow) self.actionSave.setObjectName("actionSave") self.action_Gmail_Advanced_Search_Syntax = QAction(MainWindow) self.action_Gmail_Advanced_Search_Syntax.setObjectName("action_Gmail_Advanced_Search_Syntax") self.menu_file.addAction(self.action_exit) self.menu_help.addAction(self.action_Gmail_Advanced_Search_Syntax) self.menu_help.addSeparator() self.menu_help.addAction(self.action_about) self.menu_help.addAction(self.action_About_Qt) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_help.menuAction()) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.client_secrets_file_path_le, self.client_secret_file_path_tBtn) MainWindow.setTabOrder(self.client_secret_file_path_tBtn, self.remove_account_btn) MainWindow.setTabOrder(self.remove_account_btn, self.add_account_btn) MainWindow.setTabOrder(self.add_account_btn, self.accounts_cb) MainWindow.setTabOrder(self.decryption_key_le, self.connect_btn) MainWindow.setTabOrder(self.connect_btn, self.log_te) MainWindow.setTabOrder(self.log_te, self.mailboxes_lw) MainWindow.setTabOrder(self.mailboxes_lw, self.after_date_cb) MainWindow.setTabOrder(self.after_date_cb, self.after_date_edit) MainWindow.setTabOrder(self.after_date_edit, self.before_date_cb) MainWindow.setTabOrder(self.before_date_cb, self.before_date_edit) MainWindow.setTabOrder(self.before_date_edit, self.from_le) MainWindow.setTabOrder(self.from_le, self.to_le) MainWindow.setTabOrder(self.to_le, self.subject_le) MainWindow.setTabOrder(self.subject_le, self.thread_count_sb) MainWindow.setTabOrder(self.thread_count_sb, self.html_radio) MainWindow.setTabOrder(self.html_radio, self.text_radio) MainWindow.setTabOrder(self.text_radio, self.search_btn) MainWindow.setTabOrder(self.search_btn, self.parameters_cb) MainWindow.setTabOrder(self.parameters_cb, self.parameters_le) MainWindow.setTabOrder(self.parameters_le, self.disconnect_btn) MainWindow.setTabOrder(self.disconnect_btn, self.links_text_edit) MainWindow.setTabOrder(self.links_text_edit, self.export_txt_btn) MainWindow.setTabOrder(self.export_txt_btn, self.export_html_btn) MainWindow.setTabOrder(self.export_html_btn, self.mailboxes_lw) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QApplication.translate("MainWindow", "Gmail URL Parser", None, QApplication.UnicodeUTF8)) self.login_gbox.setTitle(QApplication.translate("MainWindow", " Client secrets file path ", None, QApplication.UnicodeUTF8)) self.client_secrets_file_path_le.setPlaceholderText(QApplication.translate("MainWindow", "Please select your client secrets file", None, QApplication.UnicodeUTF8)) self.lb_client_secrets_file_path.setText(QApplication.translate("MainWindow", "Path", None, QApplication.UnicodeUTF8)) self.connect_btn.setText(QApplication.translate("MainWindow", "Connect", None, QApplication.UnicodeUTF8)) self.client_secret_file_path_tBtn.setText(QApplication.translate("MainWindow", "...", None, QApplication.UnicodeUTF8)) self.lb_account.setText(QApplication.translate("MainWindow", "Account", None, QApplication.UnicodeUTF8)) self.add_account_btn.setText(QApplication.translate("MainWindow", "+", None, QApplication.UnicodeUTF8)) self.remove_account_btn.setText(QApplication.translate("MainWindow", "-", None, QApplication.UnicodeUTF8)) self.decryption_key_le.setPlaceholderText(QApplication.translate("MainWindow", "Decryption key", None, QApplication.UnicodeUTF8)) self.lb_decryption_key.setText(QApplication.translate("MainWindow", "Key", None, QApplication.UnicodeUTF8)) self.log_gbox.setTitle(QApplication.translate("MainWindow", " Log ", None, QApplication.UnicodeUTF8)) self.search_gbox.setTitle(QApplication.translate("MainWindow", " Search Parameters ", None, QApplication.UnicodeUTF8)) self.lb_to.setText(QApplication.translate("MainWindow", "To", None, QApplication.UnicodeUTF8)) self.lb_from.setText(QApplication.translate("MainWindow", "From", None, QApplication.UnicodeUTF8)) self.lb_subject.setText(QApplication.translate("MainWindow", "Subject", None, QApplication.UnicodeUTF8)) self.search_btn.setText(QApplication.translate("MainWindow", "Search", None, QApplication.UnicodeUTF8)) self.after_date_edit.setDisplayFormat(QApplication.translate("MainWindow", "yyyy-MM-dd", None, QApplication.UnicodeUTF8)) self.before_date_edit.setDisplayFormat(QApplication.translate("MainWindow", "yyyy-MM-dd", None, QApplication.UnicodeUTF8)) self.lb_select_mailbox.setToolTip(QApplication.translate("MainWindow", "<html><head/><body><p>Select multiple items to select labels</p></body></html>", None, QApplication.UnicodeUTF8)) self.lb_select_mailbox.setText(QApplication.translate("MainWindow", "Select Mailbox or Labels", None, QApplication.UnicodeUTF8)) self.after_date_cb.setText(QApplication.translate("MainWindow", "After", None, QApplication.UnicodeUTF8)) self.before_date_cb.setText(QApplication.translate("MainWindow", "Before", None, QApplication.UnicodeUTF8)) self.html_radio.setText(QApplication.translate("MainWindow", "html", None, QApplication.UnicodeUTF8)) self.text_radio.setText(QApplication.translate("MainWindow", "text", None, QApplication.UnicodeUTF8)) self.lb_threads.setText(QApplication.translate("MainWindow", "Threads", None, QApplication.UnicodeUTF8)) self.links_gbox.setTitle(QApplication.translate("MainWindow", " Links ", None, QApplication.UnicodeUTF8)) self.disconnect_btn.setText(QApplication.translate("MainWindow", "Disconnect", None, QApplication.UnicodeUTF8)) self.export_txt_btn.setText(QApplication.translate("MainWindow", "Export as txt", None, QApplication.UnicodeUTF8)) self.export_html_btn.setText(QApplication.translate("MainWindow", "Export as HTML", None, QApplication.UnicodeUTF8)) self.menu_file.setTitle(QApplication.translate("MainWindow", "File", None, QApplication.UnicodeUTF8)) self.menu_help.setTitle(QApplication.translate("MainWindow", "Help", None, QApplication.UnicodeUTF8)) self.action_about.setText(QApplication.translate("MainWindow", "About", None, QApplication.UnicodeUTF8)) self.action_About_Qt.setText(QApplication.translate("MainWindow", "About Qt", None, QApplication.UnicodeUTF8)) self.action_exit.setText(QApplication.translate("MainWindow", "Exit", None, QApplication.UnicodeUTF8)) self.action_exit.setShortcut(QApplication.translate("MainWindow", "Ctrl+Q", None, QApplication.UnicodeUTF8)) self.actionSave.setText(QApplication.translate("MainWindow", "Save", None, QApplication.UnicodeUTF8)) self.action_Gmail_Advanced_Search_Syntax.setText(QApplication.translate("MainWindow", "Gmail Advanced Search Syntax", None, QApplication.UnicodeUTF8))
class MovementEditor(QWidget): def __init__(self): QWidget.__init__(self) self.setGeometry(QRect(100, 100, 400, 200)) self.layout = QtGui.QGridLayout(self) #lblAssetType self.lblAssetType = QLabel("Asset Type") self.layout.addWidget(self.lblAssetType, 0, 0) #cmdAssetType self.cmdAssetType = QComboBox(self) self.cmdAssetType.addItems(DaoAsset().getAssetTypes()) self.layout.addWidget(self.cmdAssetType, 0, 1) #lblAssetName self.lblAssetName = QLabel("Asset Name") self.layout.addWidget(self.lblAssetName, 1, 0) #cmdAssetName self.cmdAssetName = QComboBox(self) self.layout.addWidget(self.cmdAssetName, 1, 1) #lblCustody self.lblCustody = QLabel("Custody") self.layout.addWidget(self.lblCustody, 2, 0) #cmbCustody self.cmbCustody = QComboBox(self) custodyList = DaoCustody().getCustodyList() for (row) in custodyList: self.cmbCustody.addItem(row[1], row[0]) self.layout.addWidget(self.cmbCustody, 2, 1) #lblBuySell self.lblBuySell = QLabel("Buy Sell") self.layout.addWidget(self.lblBuySell, 3, 0) #cmdBuySell self.cmdBuySell = QComboBox(self) self.cmdBuySell.addItem("BUY") self.cmdBuySell.addItem("SELL") self.layout.addWidget(self.cmdBuySell, 3, 1) #lblByAmount self.lblByAmount = QLabel("By Amount") self.layout.addWidget(self.lblByAmount, 4, 0) #chkByAmount self.chkByAmount = QCheckBox(self) self.layout.addWidget(self.chkByAmount, 4, 1) #lblGrossAmount self.lblGrossAmount = QLabel("Gross Amount") self.layout.addWidget(self.lblGrossAmount, 5, 0) #txtGrossAmount self.txtGrossAmount = QLineEdit(self) self.txtGrossAmount.setValidator(QDoubleValidator( 0, 99999999, 6, self)) self.layout.addWidget(self.txtGrossAmount, 5, 1) #lblAcquisitionDate self.lblAcquisitionDate = QLabel("Acquisition Date") self.layout.addWidget(self.lblAcquisitionDate, 6, 0) #cmdAcquisitionDate self.dateAcquisitionDate = QDateEdit(self) self.dateAcquisitionDate.setDisplayFormat("dd-MM-yyyy") self.dateAcquisitionDate.setDate(datetime.datetime.now()) self.layout.addWidget(self.dateAcquisitionDate, 6, 1) #lblQuantity self.lblQuantity = QLabel("Quantity") self.layout.addWidget(self.lblQuantity, 7, 0) #txtQuantity self.txtQuantity = QLineEdit(self) self.txtQuantity.setValidator(QIntValidator(0, 1000000000, self)) self.layout.addWidget(self.txtQuantity, 7, 1) #lblPrice self.lblPrice = QLabel("Price") self.layout.addWidget(self.lblPrice, 8, 0) #txtPrice self.txtPrice = QLineEdit(self) self.txtPrice.setValidator(QDoubleValidator(0, 99999999, 6, self)) self.layout.addWidget(self.txtPrice, 8, 1) #lblRate self.lblRate = QLabel("Rate") self.layout.addWidget(self.lblRate, 9, 0) #txtRate self.txtRate = QLineEdit(self) self.txtRate.setValidator(QDoubleValidator(0, 99999999, 4, self)) self.txtRate.setEnabled(0) self.layout.addWidget(self.txtRate, 9, 1) #lblNetAmount self.lblNetAmount = QLabel("Net Amount") self.layout.addWidget(self.lblNetAmount, 10, 0) #txtNetAmount self.txtNetAmount = QLineEdit(self) self.txtNetAmount.setEnabled(0) self.txtNetAmount.setValidator(QDoubleValidator(0, 99999999, 6, self)) self.layout.addWidget(self.txtNetAmount, 10, 1) #lblCommissionPercentage self.lblCommissionPercentage = QLabel("Commission Percentage") self.layout.addWidget(self.lblCommissionPercentage, 11, 0) #txtCommissionPercentage self.txtCommissionPercentage = QLineEdit(self) self.txtCommissionPercentage.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionPercentage, 11, 1) #lblCommissionAmount self.lblCommissionAmount = QLabel("Commission Amount") self.layout.addWidget(self.lblCommissionAmount, 12, 0) #txtCommissionAmmount self.txtCommissionAmount = QLineEdit(self) self.txtCommissionAmount.setEnabled(0) self.txtCommissionAmount.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionAmount, 12, 1) #lblCommissionAmount self.lblCommissionVATAmount = QLabel("Commission VAT Amount") self.layout.addWidget(self.lblCommissionVATAmount, 13, 0) #txtCommissionAmmount self.txtCommissionVATAmount = QLineEdit(self) self.txtCommissionVATAmount.setEnabled(0) self.txtCommissionVATAmount.setValidator( QDoubleValidator(0, 9999999, 6, self)) self.layout.addWidget(self.txtCommissionVATAmount, 13, 1) #lblTenor self.lblTenor = QLabel("Tenor") self.layout.addWidget(self.lblTenor, 14, 0) #txtTenor self.txtTenor = QLineEdit(self) self.txtTenor.setEnabled(0) self.txtTenor.setValidator(QDoubleValidator(0, 9999999, 0, self)) self.layout.addWidget(self.txtTenor, 14, 1) #btnAdd self.btnAdd = QPushButton("Add", self) self.layout.addWidget(self.btnAdd) #btnClear self.btnClear = QPushButton("Clear", self) self.layout.addWidget(self.btnClear) #clearEditor self.clearEditor() self.initListener() def initListener(self): self.cmdBuySell.connect( self.cmdBuySell, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.calculateNetAmount) self.chkByAmount.connect(self.chkByAmount, QtCore.SIGNAL("stateChanged(int)"), self.configEditorByAmount) self.txtGrossAmount.connect(self.txtGrossAmount, SIGNAL("editingFinished()"), self.calculatePrice) self.cmdAssetType.connect( self.cmdAssetType, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.configEditorByAssetType) self.txtQuantity.connect(self.txtQuantity, SIGNAL("textChanged(QString)"), self.calculateGrossAmount) self.txtQuantity.connect(self.txtQuantity, SIGNAL("textChanged(QString)"), self.calculatePrice) self.txtPrice.connect(self.txtPrice, SIGNAL("textChanged(QString)"), self.calculateGrossAmount) self.cmdAssetName.connect( self.cmdAssetName, SIGNAL("currentIndexChanged(const QString&)"), self.setDefaultCustody) self.txtCommissionPercentage.connect(self.txtCommissionPercentage, SIGNAL("textChanged(QString)"), self.calculateCommission) self.btnAdd.clicked.connect(self.addMovement) self.btnClear.clicked.connect(self.clearEditor) def addMovement(self): buySell = self.cmdBuySell.currentText() assetOID = self.cmdAssetName.itemData(self.cmdAssetName.currentIndex()) custodyOID = self.cmbCustody.itemData(self.cmbCustody.currentIndex()) acquisitionDate = self.dateAcquisitionDate.date() quantity = self.txtQuantity.text() if self.cmdAssetType.currentText() == 'BOND': rate = self.txtRate.text() if self.txtTenor.text() == '': tenor = None else: tenor = self.txtTenor.text() maturityDate = acquisitionDate.toPython() + datetime.timedelta( days=int(tenor)) else: rate = None maturityDate = None tenor = None price = self.txtPrice.text() grossAmount = self.txtGrossAmount.text() netAmount = self.txtNetAmount.text() commissionPercentage = self.txtCommissionPercentage.text() commissionAmount = self.txtCommissionAmount.text() commissionVATAmount = self.txtCommissionVATAmount.text() movement = Movement(None) movement.setAttr(None, assetOID, buySell, (acquisitionDate).toPython(), quantity, price, rate, grossAmount, netAmount, commissionPercentage, commissionAmount, commissionVATAmount, tenor, custodyOID, maturityDate, None, None) DaoMovement.insertMovement(movement) self.clearEditor() def clearEditor(self): #self.cmdAssetType.set self.txtQuantity.setText(None) self.txtPrice.setText(None) self.txtGrossAmount.setText("0") self.txtNetAmount.setText("0") self.txtRate.setText("0") #configDefaultCommission if self.cmdAssetType.currentText() == 'EQUITY': self.txtCommissionPercentage.setText( str(Constant.CONST_DEF_EQUITY_COMMISSION_PERCENTAGE)) else: self.txtCommissionPercentage.setText( str(Constant.CONST_DEF_OTHER_COMMISSION_PERCENTAGE)) self.txtTenor.setText("") self.dateAcquisitionDate.setDate(datetime.datetime.now()) self.configEditorByAmount() self.configEditorByAssetType() def setDefaultCustody(self): defaultCustodyID = DaoCustody().getDefaultCustody( self.cmdAssetName.currentText()) for (row) in defaultCustodyID: self.cmbCustody.setCurrentIndex(self.cmbCustody.findData(row[0])) def configEditorByAssetType(self): self.cmdAssetName.clear() #loadAssetNames assetNameList = DaoAsset().getAssetNames( self.cmdAssetType.currentText()) for (assetName) in assetNameList: self.cmdAssetName.addItem(assetName[1], assetName[0]) #setPriceOrRate if self.cmdAssetType.currentText( ) == 'EQUITY' or self.cmdAssetType.currentText() == 'FUND': self.txtPrice.setEnabled(1) self.txtRate.setEnabled(0) self.txtRate.setText("0") self.txtTenor.setEnabled(0) self.txtTenor.setText(None) else: self.txtPrice.setEnabled(0) self.txtRate.setEnabled(1) self.txtPrice.setText("0") self.txtTenor.setEnabled(1) self.txtTenor.setText(None) #configDefaultCommission if self.cmdAssetType.currentText() == 'EQUITY': self.txtCommissionPercentage.setText( str(Constant.CONST_DEF_EQUITY_COMMISSION_PERCENTAGE)) else: self.txtCommissionPercentage.setText( str(Constant.CONST_DEF_OTHER_COMMISSION_PERCENTAGE)) def configEditorByAmount(self): if self.chkByAmount.isChecked(): self.txtPrice.setEnabled(0) self.txtGrossAmount.setEnabled(1) else: self.txtPrice.setEnabled(1) self.txtGrossAmount.setEnabled(0) def calculateCommission(self): commissionPercentage = self.txtCommissionPercentage.text() grossAmount = self.txtGrossAmount.text() if commissionPercentage >= 0: commissionAmount = float(grossAmount) * float(commissionPercentage) self.txtCommissionAmount.setText( str('{0:.6f}'.format(commissionAmount))) commissionVATAmount = commissionAmount * Constant.CONST_IVA_PERCENTAGE self.txtCommissionVATAmount.setText( str('{0:.6f}'.format(commissionVATAmount))) self.calculateNetAmount() def calculatePrice(self): quantity = self.txtQuantity.text() amount = self.txtGrossAmount.text() if (quantity is not u"" or None) and (amount is not u"" or None): self.txtPrice.setText( str('{0:.6f}'.format(float(amount) / float(quantity)))) def calculateNetAmount(self): buySell = self.cmdBuySell.currentText() grossAmount = float(self.txtGrossAmount.text()) commissionAmount = float(self.txtCommissionAmount.text()) commissionVATAmount = float(self.txtCommissionVATAmount.text()) if buySell == 'BUY': netAmount = grossAmount + commissionVATAmount + commissionAmount else: netAmount = grossAmount - commissionVATAmount - commissionAmount self.txtNetAmount.setText(str(netAmount)) def calculateGrossAmount(self): quantity = self.txtQuantity.text() price = self.txtPrice.text() if (not self.chkByAmount.isChecked()) and ( quantity is not u"" or None) and (price is not u"" or None): self.txtGrossAmount.setText( str('{0:.6f}'.format(float(quantity) * float(price)))) self.calculateCommission()
def setup_pop(self): """ sets up the form. """ self.grid_layout = QGridLayout(self) self.label_1 = QLabel(self) self.grid_layout.addWidget(self.label_1, 0, 0, 1, 1) self.code_line = QLineEdit(self) self.code_line.setValidator(QIntValidator(0, 99999)) self.grid_layout.addWidget(self.code_line, 0, 1, 1, 1) self.label_2 = QLabel(self) self.grid_layout.addWidget(self.label_2, 1, 0, 1, 1) self.date_line = QDateEdit(self) self.date_line.setCalendarPopup(True) self.grid_layout.addWidget(self.date_line, 1, 1, 1, 1) self.label_3 = QLabel(self) self.grid_layout.addWidget(self.label_3, 2, 0, 1, 1) self.organization_line = QLineEdit(self) self.grid_layout.addWidget(self.organization_line, 2, 1, 1, 1) self.label_4 = QLabel(self) self.grid_layout.addWidget(self.label_4, 3, 0, 1, 1) self.test_line = QLineEdit(self) self.grid_layout.addWidget(self.test_line, 3, 1, 1, 1) self.label_5 = QLabel(self) self.grid_layout.addWidget(self.label_5, 4, 0, 1, 1) self.description_line = QLineEdit(self) self.grid_layout.addWidget(self.description_line, 4, 1, 1, 1) self.image_label = QLabel(self) self.pixmap = QPixmap(':/images/upload.png') # self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation) #not used self.image_label.setPixmap(self.pixmap) self.image_label.setScaledContents(True) self.grid_layout.addWidget(self.image_label, 0, 2, 5, 2) self.horizontal = QHBoxLayout() self.delete_button = QPushButton(self) self.horizontal.addWidget(self.delete_button) self.create_button = QPushButton(self) self.horizontal.addWidget(self.create_button) self.update_button = QPushButton(self) self.horizontal.addWidget(self.update_button) self.upload_button = QPushButton(self) self.horizontal.addWidget(self.upload_button) self.grid_layout.addLayout(self.horizontal, 5, 0, 1, 4) ### retanslate self.label_1.setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.label_2.setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.date_line.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.label_3.setText( QApplication.translate("MainWindow", "Organization Name", None, QApplication.UnicodeUTF8)) self.label_4.setText( QApplication.translate("MainWindow", "Test", None, QApplication.UnicodeUTF8)) self.label_5.setText( QApplication.translate("MainWindow", "Description", None, QApplication.UnicodeUTF8)) self.delete_button.setText( QApplication.translate("MainWindow", "Delete", None, QApplication.UnicodeUTF8)) self.create_button.setText( QApplication.translate("MainWindow", "Create", None, QApplication.UnicodeUTF8)) self.update_button.setText( QApplication.translate("MainWindow", "Update", None, QApplication.UnicodeUTF8)) self.upload_button.setText( QApplication.translate("MainWindow", "Upload", None, QApplication.UnicodeUTF8)) self.create_button.clicked.connect(self.create_report) self.upload_button.clicked.connect(self.open_file) self.update_button.clicked.connect(self.update_report) self.delete_button.clicked.connect(self.delete_report) self.image_label.mouseReleaseEvent = self.image_viewer
class HygieneReportPop(QDialog): """ The Report Form Handler """ def __init__(self, parent=None, code=None, table=None): super(HygieneReportPop, self).__init__() self.setup_pop() # do not change the order of these two function self.code = code self.parent_object = parent self.image_data = None self.process_override( table=table) # do not change the order of these two function if not code: self.update_button.setHidden(True) self.delete_button.setHidden(True) self.calculate_code() else: self.create_button.setHidden(True) self.update_data() def process_override(self, table): """ Function that assigns the table and tryton backend handler objects based on the tables :param table: the table name """ try: if table == 'pest_table': self.backend_handle = self.parent_object.pest self.table = self.parent_object.report_hyginepest_table elif table == 'water_table': self.backend_handle = self.parent_object.water self.table = self.parent_object.report_hyginewater_table elif table == 'health_table': self.backend_handle = self.parent_object.health self.table = self.parent_object.report_health_table except Exception: if settings.level == 10: logger.exception('raised exception') return False, 'Some Internal Error' def setup_pop(self): """ sets up the form. """ self.grid_layout = QGridLayout(self) self.label_1 = QLabel(self) self.grid_layout.addWidget(self.label_1, 0, 0, 1, 1) self.code_line = QLineEdit(self) self.code_line.setValidator(QIntValidator(0, 99999)) self.grid_layout.addWidget(self.code_line, 0, 1, 1, 1) self.label_2 = QLabel(self) self.grid_layout.addWidget(self.label_2, 1, 0, 1, 1) self.date_line = QDateEdit(self) self.date_line.setCalendarPopup(True) self.grid_layout.addWidget(self.date_line, 1, 1, 1, 1) self.label_3 = QLabel(self) self.grid_layout.addWidget(self.label_3, 2, 0, 1, 1) self.organization_line = QLineEdit(self) self.grid_layout.addWidget(self.organization_line, 2, 1, 1, 1) self.label_4 = QLabel(self) self.grid_layout.addWidget(self.label_4, 3, 0, 1, 1) self.test_line = QLineEdit(self) self.grid_layout.addWidget(self.test_line, 3, 1, 1, 1) self.label_5 = QLabel(self) self.grid_layout.addWidget(self.label_5, 4, 0, 1, 1) self.description_line = QLineEdit(self) self.grid_layout.addWidget(self.description_line, 4, 1, 1, 1) self.image_label = QLabel(self) self.pixmap = QPixmap(':/images/upload.png') # self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation) #not used self.image_label.setPixmap(self.pixmap) self.image_label.setScaledContents(True) self.grid_layout.addWidget(self.image_label, 0, 2, 5, 2) self.horizontal = QHBoxLayout() self.delete_button = QPushButton(self) self.horizontal.addWidget(self.delete_button) self.create_button = QPushButton(self) self.horizontal.addWidget(self.create_button) self.update_button = QPushButton(self) self.horizontal.addWidget(self.update_button) self.upload_button = QPushButton(self) self.horizontal.addWidget(self.upload_button) self.grid_layout.addLayout(self.horizontal, 5, 0, 1, 4) ### retanslate self.label_1.setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.label_2.setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.date_line.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.label_3.setText( QApplication.translate("MainWindow", "Organization Name", None, QApplication.UnicodeUTF8)) self.label_4.setText( QApplication.translate("MainWindow", "Test", None, QApplication.UnicodeUTF8)) self.label_5.setText( QApplication.translate("MainWindow", "Description", None, QApplication.UnicodeUTF8)) self.delete_button.setText( QApplication.translate("MainWindow", "Delete", None, QApplication.UnicodeUTF8)) self.create_button.setText( QApplication.translate("MainWindow", "Create", None, QApplication.UnicodeUTF8)) self.update_button.setText( QApplication.translate("MainWindow", "Update", None, QApplication.UnicodeUTF8)) self.upload_button.setText( QApplication.translate("MainWindow", "Upload", None, QApplication.UnicodeUTF8)) self.create_button.clicked.connect(self.create_report) self.upload_button.clicked.connect(self.open_file) self.update_button.clicked.connect(self.update_report) self.delete_button.clicked.connect(self.delete_report) self.image_label.mouseReleaseEvent = self.image_viewer def update_data(self): """ Updates the data in the form """ try: data = self.backend_handle.read_report(code=int(self.code)) if data: if data[0]: data = data[1] self.code_line.setText(data['code']) self.code_line.setDisabled(True) self.date_line.setDate(data['date']) self.organization_line.setText(data['organization']) self.test_line.setText(data['test']) self.description_line.setText(data['description']) self.image_data = str(data['report']) self.pixmap = QPixmap() self.pixmap.loadFromData(self.image_data) self.image_label.setPixmap( self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation)) except Exception: if settings.level == 10: logger.exception('raised exception') return False, 'Some Internal Error' def image_viewer(self, event=None): """pops up a image viewer to check the details""" dialog = QDialog() dialog.setWindowFlags(Qt.WindowTitleHint | Qt.WindowStaysOnTopHint) layout = QHBoxLayout(dialog) label = QLabel(dialog) # self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation) label.setPixmap(self.pixmap) label.setScaledContents(True) layout.addWidget(label) dialog.exec_() def open_file(self): """ saves the file """ dialog = QFileDialog(self) dialog.setNameFilter("Image Files (*.png *.jpg *.bmp)") dialog.setStyleSheet('color:black;') name = '' if dialog.exec_(): name = dialog.selectedFiles() if name: self.image_data = open(name[0], 'rb').read() self.pixmap = QPixmap(name[0]) self.image_label.setPixmap( self.pixmap.scaled(self.image_label.size(), Qt.KeepAspectRatio, Qt.FastTransformation)) def create_report(self): """ Creates a new Report """ try: data = self.get_data() if data: status = self.backend_handle.create_report(data=data) if status: if status[0]: QMessageBox.information(self, 'Success', status[1], QMessageBox.Ok) self.create_button.setHidden(True) self.delete_button.setVisible(True) self.update_button.setVisible(True) self.code = data['code'] self.update_data() else: QMessageBox.critical(self, 'Error', status[1], QMessageBox.Ok) except Exception: if settings.level == 10: logger.exception('raised exception') return False, 'Some Internal Error' def update_report(self): """ Updates an existing Report """ try: data = self.get_data() if data: status = self.backend_handle.update_report(data=data) if status: if status[0]: QMessageBox.information(self, 'Success', status[1], QMessageBox.Ok) else: QMessageBox.critical(self, 'Error', status[1], QMessageBox.Ok) except Exception: if settings.level == 10: logger.exception('raised exception') return False, 'Some Internal Error' def get_data(self): """ Gets the data from the form as a dictionary :return:dictionary """ try: data = {} data['code'] = self.code_line.text() data['date'] = self.date_line.text() data['organization'] = self.organization_line.text() data['test'] = self.test_line.text() data['description'] = self.description_line.text() data['report'] = self.image_data for key, value in data.iteritems(): if not value: QMessageBox.critical( self, 'Error', 'Insert Proper value for %s' % key.title(), QMessageBox.Ok) return False return data except Exception: if settings.level == 10: logger.exception('raised exception') return False def delete_report(self): """ Deletes the existing report :return: """ try: code = self.code_line.text() status = self.backend_handle.delete_report(code=code) if status: if status[0]: QMessageBox.information(self, 'Success', status[1], QMessageBox.Ok) self.close() else: QMessageBox.critical(self, 'Error', status[1], QMessageBox.Ok) except Exception: if settings.level == 10: logger.exception('raised exception') return False, 'Some Internal Error' def calculate_code(self): """ Calculates the entry number, Eases the user for entering the code """ try: table = self.table if table: code = [] rows = table.rowCount() for row in range(rows): code.append(table.item(row, 0).text()) if code: new_code = str(int(max(code)) + 1) self.code_line.setText(new_code) except Exception: if settings.level == 10: logger.exception('raised exception') return False, 'Some Internal Error'
class CorporateEventEditor(QWidget): def __init__(self): QWidget.__init__(self) self.setGeometry(QRect(100, 100, 400, 200)) self.layout = QtGui.QGridLayout(self) #lblCorporateEventType self.lblCorporateEventType = QLabel("Type") self.layout.addWidget(self.lblCorporateEventType, 0, 0) #cmbCorporateEventType self.cmbCorporateEventType = QComboBox(self) corporateEventTypeList = DaoCorporateEvent().getCorporateEventTypeList( ) for (corporateEventType) in corporateEventTypeList: self.cmbCorporateEventType.addItem(corporateEventType[1], corporateEventType[0]) self.layout.addWidget(self.cmbCorporateEventType, 0, 1) #lblAssetName self.lblAssetName = QLabel("Asset Name") self.layout.addWidget(self.lblAssetName, 1, 0) #cmdAssetName self.cmdAssetName = QComboBox(self) assetNameList = DaoAsset().getAssetNames('EQUITY') for (assetName) in assetNameList: self.cmdAssetName.addItem(assetName[1], assetName[0]) self.layout.addWidget(self.cmdAssetName, 1, 1) #lblCustody self.lblCustody = QLabel("Custody") self.layout.addWidget(self.lblCustody, 2, 0) #cmbCustody self.cmbCustody = QComboBox(self) custodyList = DaoCustody().getCustodyList() for (row) in custodyList: self.cmbCustody.addItem(row[1], row[0]) self.layout.addWidget(self.cmbCustody, 2, 1) #lblGrossAmount self.lblGrossAmount = QLabel("Gross Amount") self.layout.addWidget(self.lblGrossAmount, 3, 0) #txtGrossAmount self.txtGrossAmount = QLineEdit(self) self.txtGrossAmount.setValidator(QDoubleValidator( 0, 99999999, 6, self)) self.layout.addWidget(self.txtGrossAmount, 3, 1) #lblPaymentDate self.lblPaymentDate = QLabel("Payment Date") self.layout.addWidget(self.lblPaymentDate, 4, 0) #cmbPaymentDate self.cmbPaymentDate = QDateEdit(self) self.cmbPaymentDate.setDisplayFormat("dd-MM-yyyy") self.cmbPaymentDate.setDate(datetime.datetime.now()) self.layout.addWidget(self.cmbPaymentDate, 4, 1) #btnAdd self.btnAdd = QPushButton("Add", self) self.layout.addWidget(self.btnAdd) #btnClear self.btnClear = QPushButton("Clear", self) self.layout.addWidget(self.btnClear) #clearEditor self.clearEditor() self.initListener() def initListener(self): self.cmdAssetName.connect( self.cmdAssetName, SIGNAL("currentIndexChanged(const QString&)"), self.setDefaultCustody) self.btnAdd.clicked.connect(self.addCorporateEvent) self.btnClear.clicked.connect(self.clearEditor) def addCorporateEvent(self): corporateEvent = CorporateEvent(None) corporateEvent.assetOID = self.cmdAssetName.itemData( self.cmdAssetName.currentIndex()) corporateEvent.corporateEventTypeOID = self.cmbCorporateEventType.itemData( self.cmbCorporateEventType.currentIndex()) corporateEvent.custodyOID = self.cmbCustody.itemData( self.cmbCustody.currentIndex()) corporateEvent.paymentDate = (self.cmbPaymentDate.date()).toPython() corporateEvent.grossAmount = self.txtGrossAmount.text() DaoCorporateEvent().insert(corporateEvent) self.clearEditor() def clearEditor(self): self.txtGrossAmount.setText("0") self.cmbPaymentDate.setDate(datetime.datetime.now()) def setDefaultCustody(self): defaultCustodyID = DaoCustody().getDefaultCustody( self.cmdAssetName.currentText()) for (row) in defaultCustodyID: self.cmbCustody.setCurrentIndex(self.cmbCustody.findData(row[0]))
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(810, 492) lbMinWidth = 65 lbMinWidthLogin = 110 # leMinWidth = 200 # self.centralwidget = QWidget(MainWindow) self.mainSplitter = QSplitter(Qt.Horizontal, MainWindow) self.mainSplitter.setObjectName("centralwidget") self.mainSplitter.setProperty("childrenCollapsible", False) MainWindow.setCentralWidget(self.mainSplitter) self.leftSplitter = QSplitter(Qt.Vertical, self.mainSplitter) self.leftSplitter.setProperty("childrenCollapsible", False) # login_gbox self.login_gbox = QGroupBox(self.leftSplitter) self.login_gbox.setFlat(True) self.login_gbox.setObjectName("login_gbox") login_gbox_layout = QVBoxLayout(self.login_gbox) login_gbox_presets_layout = QHBoxLayout() login_gbox_server_layout = QHBoxLayout() login_gbox_ssl_layout = QHBoxLayout() login_gbox_address_layout = QHBoxLayout() login_gbox_pass_layout = QHBoxLayout() login_gbox_connect_layout = QHBoxLayout() login_gbox_layout.addLayout(login_gbox_presets_layout) login_gbox_layout.addLayout(login_gbox_server_layout) login_gbox_layout.addLayout(login_gbox_ssl_layout) login_gbox_layout.addLayout(login_gbox_address_layout) login_gbox_layout.addLayout(login_gbox_pass_layout) login_gbox_layout.addLayout(login_gbox_connect_layout) self.lb_presets = QLabel(self.login_gbox) self.lb_presets.setObjectName("lb_presets") self.lb_presets.setMinimumWidth(lbMinWidthLogin) self.lb_presets.setMaximumWidth(lbMinWidthLogin) self.presets_cbox = QComboBox(self.login_gbox) self.presets_cbox.setObjectName("presets_cbox") self.add_preset_btn = QPushButton(self.login_gbox) self.add_preset_btn.setObjectName("add_preset_btn") self.add_preset_btn.setMaximumWidth(30) self.remove_preset_btn = QPushButton(self.login_gbox) self.remove_preset_btn.setObjectName("remove_preset_btn") self.remove_preset_btn.setMaximumWidth(20) login_gbox_presets_layout.addWidget(self.lb_presets) login_gbox_presets_layout.addWidget(self.presets_cbox) login_gbox_presets_layout.addWidget(self.add_preset_btn) login_gbox_presets_layout.addWidget(self.remove_preset_btn) self.lb_imap_server = QLabel(self.login_gbox) self.lb_imap_server.setObjectName("lb_imap_server") self.lb_imap_server.setMinimumWidth(lbMinWidthLogin) self.imap_server_le = QLineEdit(self.login_gbox) self.imap_server_le.setObjectName("imap_server_le") login_gbox_server_layout.addWidget(self.lb_imap_server) login_gbox_server_layout.addWidget(self.imap_server_le) self.lb_ssl = QLabel(self.login_gbox) self.lb_ssl.setObjectName("lb_ssl") self.lb_ssl.setMinimumWidth(lbMinWidthLogin) self.lb_ssl.setMaximumWidth(lbMinWidthLogin) self.ssl_cb = QCheckBox(self.login_gbox) self.ssl_cb.setEnabled(False) self.ssl_cb.setCheckable(True) self.ssl_cb.setChecked(True) self.ssl_cb.setObjectName("ssl_cb") login_gbox_ssl_layout.addWidget(self.lb_ssl) login_gbox_ssl_layout.addWidget(self.ssl_cb) self.lb_adress = QLabel(self.login_gbox) self.lb_adress.setObjectName("lb_adress") self.lb_adress.setMinimumWidth(lbMinWidthLogin) self.adress_le = QLineEdit(self.login_gbox) self.adress_le.setInputMethodHints(Qt.ImhNone) self.adress_le.setObjectName("adress_le") login_gbox_address_layout.addWidget(self.lb_adress) login_gbox_address_layout.addWidget(self.adress_le) self.lb_pass = QLabel(self.login_gbox) self.lb_pass.setObjectName("lb_pass") self.lb_pass.setMinimumWidth(lbMinWidthLogin) self.pass_le = QLineEdit(self.login_gbox) self.pass_le.setText("") self.pass_le.setEchoMode(QLineEdit.Password) self.pass_le.setObjectName("pass_le") login_gbox_pass_layout.addWidget(self.lb_pass) login_gbox_pass_layout.addWidget(self.pass_le) self.connect_btn = QPushButton(self.login_gbox) self.connect_btn.setObjectName("connect_btn") login_gbox_connect_layout.addStretch() login_gbox_connect_layout.addWidget(self.connect_btn) # search_gbox self.search_gbox = QGroupBox(self.leftSplitter) self.search_gbox.hide() self.search_gbox.setObjectName("search_gbox") search_gbox_layout = QVBoxLayout(self.search_gbox) search_gbox_mailbox_layout = QVBoxLayout() search_gbox_date_layout = QHBoxLayout() search_gbox_from_layout = QHBoxLayout() search_gbox_to_layout = QHBoxLayout() search_gbox_subject_layout = QHBoxLayout() search_gbox_threads_layout = QHBoxLayout() search_gbox_paramaters_layout = QHBoxLayout() search_gbox_layout.addLayout(search_gbox_mailbox_layout) search_gbox_layout.addLayout(search_gbox_date_layout) search_gbox_layout.addLayout(search_gbox_from_layout) search_gbox_layout.addLayout(search_gbox_to_layout) search_gbox_layout.addLayout(search_gbox_subject_layout) search_gbox_layout.addLayout(search_gbox_threads_layout) search_gbox_layout.addLayout(search_gbox_paramaters_layout) self.lb_select_mailbox = QLabel(self.search_gbox) self.lb_select_mailbox.setObjectName("lb_select_mailbox") self.mailboxes_lw = QListWidget(self.search_gbox) self.mailboxes_lw.setEditTriggers(QAbstractItemView.NoEditTriggers) self.mailboxes_lw.setSelectionMode(QAbstractItemView.ExtendedSelection) self.mailboxes_lw.setObjectName("mailboxes_lw") search_gbox_mailbox_layout.addWidget(self.lb_select_mailbox) search_gbox_mailbox_layout.addWidget(self.mailboxes_lw) self.since_date_cb = QCheckBox(self.search_gbox) self.since_date_cb.setObjectName("since_date_cb") self.since_date_cb.setMinimumWidth(lbMinWidth) self.since_date_cb.setMaximumWidth(lbMinWidth) self.since_date_edit = QDateEdit(self.search_gbox) self.since_date_edit.setCalendarPopup(True) self.since_date_edit.setObjectName("since_date_edit") self.since_date_edit.setDate(QDate.currentDate().addDays(-365)) self.since_date_edit.setMaximumDate(QDate.currentDate()) self.since_date_edit.setEnabled(False) self.before_date_cb = QCheckBox(self.search_gbox) self.before_date_cb.setObjectName("before_date_cb") self.before_date_cb.setMinimumWidth(70) self.before_date_cb.setMaximumWidth(70) self.before_date_edit = QDateEdit(self.search_gbox) self.before_date_edit.setCalendarPopup(True) self.before_date_edit.setObjectName("before_date_edit") self.before_date_edit.setDate(QDate.currentDate()) self.before_date_edit.setMaximumDate(QDate.currentDate()) self.before_date_edit.setEnabled(False) search_gbox_date_layout.addWidget(self.since_date_cb) search_gbox_date_layout.addWidget(self.since_date_edit) search_gbox_date_layout.addWidget(self.before_date_cb) search_gbox_date_layout.addWidget(self.before_date_edit) self.lb_from = QLabel(self.search_gbox) self.lb_from.setObjectName("lb_from") self.lb_from.setMinimumWidth(lbMinWidth) self.from_le = QLineEdit(self.search_gbox) self.from_le.setObjectName("from_le") search_gbox_from_layout.addWidget(self.lb_from) search_gbox_from_layout.addWidget(self.from_le) self.lb_to = QLabel(self.search_gbox) self.lb_to.setObjectName("lb_to") self.lb_to.setMinimumWidth(lbMinWidth) self.to_le = QLineEdit(self.search_gbox) self.to_le.setObjectName("to_le") search_gbox_to_layout.addWidget(self.lb_to) search_gbox_to_layout.addWidget(self.to_le) self.lb_subject = QLabel(self.search_gbox) self.lb_subject.setObjectName("lb_subject") self.lb_subject.setMinimumWidth(lbMinWidth) self.subject_le = QLineEdit(self.search_gbox) self.subject_le.setObjectName("subject_le") search_gbox_subject_layout.addWidget(self.lb_subject) search_gbox_subject_layout.addWidget(self.subject_le) # self.lb_threads = QLabel(self.search_gbox) # self.lb_threads.setObjectName("lb_threads") # self.lb_threads.setMaximumWidth(lbMinWidth) # self.thread_count_sb = QSpinBox(self.search_gbox) # self.thread_count_sb.setMinimum(1) # self.thread_count_sb.setMaximum(10) # self.thread_count_sb.setObjectName("thread_count_sb") self.html_radio = QRadioButton(self.search_gbox) self.html_radio.setObjectName("html_radio") self.text_radio = QRadioButton(self.search_gbox) self.text_radio.setObjectName("text_radio") self.extactTypeButtonGroup = QButtonGroup(self) self.extactTypeButtonGroup.addButton(self.html_radio) self.extactTypeButtonGroup.addButton(self.text_radio) self.html_radio.setChecked(True) self.search_btn = QPushButton(self.search_gbox) self.search_btn.setObjectName("search_btn") # search_gbox_threads_layout.addWidget(self.lb_threads) # search_gbox_threads_layout.addWidget(self.thread_count_sb) search_gbox_threads_layout.addStretch() search_gbox_threads_layout.addWidget(self.html_radio) search_gbox_threads_layout.addWidget(self.text_radio) # search_gbox_threads_layout.addStretch() search_gbox_threads_layout.addWidget(self.search_btn) self.parameters_cb = QCheckBox(self.search_gbox) self.parameters_cb.setText("") self.parameters_cb.setObjectName("parameters_cb") self.parameters_le = QLineEdit(self.search_gbox) self.parameters_le.setEnabled(False) self.parameters_le.setObjectName("parameters_le") search_gbox_paramaters_layout.addWidget(self.parameters_cb) search_gbox_paramaters_layout.addWidget(self.parameters_le) # log_gbox self.log_gbox = QGroupBox(self.leftSplitter) self.log_gbox.setFlat(True) self.log_gbox.setObjectName("log_gbox") log_layout = QVBoxLayout(self.log_gbox) self.log_te = QTextEdit(self.log_gbox) self.log_te.setLineWrapMode(QTextEdit.NoWrap) self.log_te.setReadOnly(True) self.log_te.setTextInteractionFlags(Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse) self.log_te.setObjectName("log_te") self.disconnect_btn = QPushButton(self.log_gbox) self.disconnect_btn.setObjectName("disconnect_btn") self.disconnect_btn.hide() log_layout.addWidget(self.log_te) log_layout_btn = QHBoxLayout() log_layout.addLayout(log_layout_btn) log_layout_btn.addWidget(self.disconnect_btn) log_layout_btn.addStretch() # links_gbox self.links_gbox = QGroupBox(self.mainSplitter) self.links_gbox.setFlat(True) self.links_gbox.setObjectName("links_gbox") links_gbox_layout = QVBoxLayout(self.links_gbox) links_gbox_links_layout = QVBoxLayout() links_gbox_buttons_layout = QHBoxLayout() links_gbox_layout.addLayout(links_gbox_links_layout) links_gbox_layout.addLayout(links_gbox_buttons_layout) self.links_text_edit = QTextEdit(self.links_gbox) self.links_text_edit.setObjectName("links_text_edit") links_gbox_links_layout.addWidget(self.links_text_edit) self.export_txt_btn = QPushButton(self.links_gbox) self.export_txt_btn.setObjectName("export_txt_btn") self.export_txt_btn.setEnabled(False) self.export_html_btn = QPushButton(self.links_gbox) self.export_html_btn.setObjectName("export_html_btn") self.export_html_btn.setEnabled(False) links_gbox_buttons_layout.addWidget(self.export_txt_btn) links_gbox_buttons_layout.addWidget(self.export_html_btn) # menubar self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName("menubar") self.menu_file = QMenu(self.menubar) self.menu_file.setObjectName("menu_file") self.menu_about = QMenu(self.menubar) self.menu_about.setObjectName("menu_about") MainWindow.setMenuBar(self.menubar) self.action_about = QAction(MainWindow) self.action_about.setObjectName("action_about") self.action_About_Qt = QAction(MainWindow) self.action_About_Qt.setObjectName("action_About_Qt") self.action_exit = QAction(MainWindow) self.action_exit.setObjectName("action_exit") self.actionSave = QAction(MainWindow) self.actionSave.setObjectName("actionSave") self.menu_file.addAction(self.action_exit) self.menu_about.addAction(self.action_about) self.menu_about.addAction(self.action_About_Qt) self.menubar.addAction(self.menu_file.menuAction()) self.menubar.addAction(self.menu_about.menuAction()) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.presets_cbox, self.imap_server_le) MainWindow.setTabOrder(self.imap_server_le, self.adress_le) MainWindow.setTabOrder(self.adress_le, self.pass_le) MainWindow.setTabOrder(self.pass_le, self.connect_btn) MainWindow.setTabOrder(self.connect_btn, self.log_te) MainWindow.setTabOrder(self.log_te, self.since_date_cb) MainWindow.setTabOrder(self.since_date_cb, self.since_date_edit) MainWindow.setTabOrder(self.since_date_edit, self.before_date_cb) MainWindow.setTabOrder(self.before_date_cb, self.before_date_edit) MainWindow.setTabOrder(self.before_date_edit, self.mailboxes_lw) MainWindow.setTabOrder(self.mailboxes_lw, self.from_le) MainWindow.setTabOrder(self.from_le, self.to_le) MainWindow.setTabOrder(self.to_le, self.subject_le) MainWindow.setTabOrder(self.subject_le, self.search_btn) MainWindow.setTabOrder(self.search_btn, self.links_text_edit) MainWindow.setTabOrder(self.links_text_edit, self.export_txt_btn) MainWindow.setTabOrder(self.export_txt_btn, self.export_html_btn) MainWindow.setTabOrder(self.export_html_btn, self.disconnect_btn) MainWindow.setTabOrder(self.disconnect_btn, self.add_preset_btn) MainWindow.setTabOrder(self.add_preset_btn, self.remove_preset_btn) MainWindow.setTabOrder(self.remove_preset_btn, self.ssl_cb)