def __init__(self, parent=None): super(Hatcher, self).__init__(parent) browser_container = BrowserContainer() record_table = RecordTable(browser_container._browser) layout = QGridLayout() layout_table = QVBoxLayout() layout_table.addWidget(record_table) groupbox_table = QGroupBox() groupbox_table.setTitle(self.tr("Record table")) groupbox_table.setLayout(layout_table) row = 0; col = 0; layout.addWidget(browser_container, row, col, 1, 4) row += 1; col += 1 layout.addWidget(groupbox_table, row, col, 1, 2) self.setLayout(layout)
def __init__(self, parent=None): super(Hatcher, self).__init__(parent) browser_container = BrowserContainer() record_table = RecordTable(browser_container._browser) layout = QGridLayout() layout_table = QVBoxLayout() layout_table.addWidget(record_table) groupbox_table = QGroupBox() groupbox_table.setTitle(self.tr("Record table")) groupbox_table.setLayout(layout_table) row = 0 col = 0 layout.addWidget(browser_container, row, col, 1, 4) row += 1 col += 1 layout.addWidget(groupbox_table, row, col, 1, 2) self.setLayout(layout)
def group(title='', *widgets): """ Creates a groupBox with the widgets inside :param title: group's title :param widgets: widgets you wqnt to qdd :type widgets: tuple[QWidget] :return: the group box :rtype: QGroupBox """ g = QGroupBox() g.setTitle(title) l = QVBoxLayout() apply_layout(l, *widgets) l.setContentsMargins(4, 4, 4, 4) g.setLayout(l) return g
def getParameterWidget(self): self.labelFixedOpacity = QLabel("Fixed:") self.labelFixedOpacity.setAlignment(Qt.AlignRight) self.labelMovingOpacity = QLabel("Moving:") self.labelMovingOpacity.setAlignment(Qt.AlignRight) self.sliderFixedOpacity = QSlider(Qt.Horizontal) self.sliderFixedOpacity.setValue( pow(self.fixedOpacity, 1.0 / 3.0) * 100.0) self.sliderMovingOpacity = QSlider(Qt.Horizontal) self.sliderMovingOpacity.setValue( pow(self.movingOpacity, 1.0 / 3.0) * 100.0) self.blendTypeComboBox = QComboBox() self.blendTypeComboBox.addItem("Default additive blend") self.blendTypeComboBox.addItem("Difference blend") self.blendTypeComboBox.currentIndexChanged.connect(self.valueChanged) # Be sure to connect after the values are set... self.sliderFixedOpacity.valueChanged.connect(self.valueChanged) self.sliderMovingOpacity.valueChanged.connect(self.valueChanged) groupLayout = QGridLayout() groupLayout.setAlignment(Qt.AlignTop) groupLayout.addWidget(self.labelFixedOpacity, 0, 0) groupLayout.addWidget(self.sliderFixedOpacity, 0, 1) groupLayout.addWidget(self.labelMovingOpacity, 1, 0) groupLayout.addWidget(self.sliderMovingOpacity, 1, 1) groupBox = QGroupBox() groupBox.setTitle("Opacity:") groupBox.setLayout(groupLayout) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(groupBox) widget = QWidget() widget.setLayout(layout) return widget
class RenderSlicerParamWidget(QWidget): """ RenderSlicerParamWidget shows parameters with which slicers can be manipulated. """ def __init__(self, renderController, parent=None): super(RenderSlicerParamWidget, self).__init__(parent=parent) self.renderController = renderController self.renderController.slicesChanged.connect(self.setSlices) self.renderController.clippingBoxChanged.connect(self.showsClippingBox) self.renderController.clippingPlanesChanged.connect( self.showsClippingPlanes) self.sliceLabelTexts = ["Axial:", "Coronal:", "Sagittal:"] self.sliceLabels = [QLabel(text) for text in self.sliceLabelTexts] self.sliceCheckBoxes = [QCheckBox() for i in range(3)] for index in range(3): self.sliceCheckBoxes[index].clicked.connect(self.checkBoxChanged) self.sliceLabels[index].setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.sliceCheckBoxes[index].setEnabled(True) slicesLayout = QGridLayout() slicesLayout.setAlignment(Qt.AlignTop) for index in range(3): slicesLayout.addWidget(self.sliceLabels[index], index + 1, 0) slicesLayout.addWidget(self.sliceCheckBoxes[index], index + 1, 1) self.slicesGroupBox = QGroupBox() self.slicesGroupBox.setTitle("Visible slices") self.slicesGroupBox.setLayout(slicesLayout) # Create option to show clipping box self.clippingCheckBox = QCheckBox() self.clippingCheckBox.setChecked(self.renderController.clippingBox) self.clippingCheckBox.clicked.connect(self.clippingCheckBoxChanged) self.clippingPlanesCheckBox = QCheckBox() self.clippingPlanesCheckBox.setChecked( self.renderController.clippingPlanes) self.clippingPlanesCheckBox.clicked.connect( self.clippingPlanesCheckBoxChanged) self.resetButton = QPushButton("Reset") self.resetButton.clicked.connect(self.resetClippingBox) clippingLabel = QLabel("Clipping box:") clippingLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) clippingPlanesLabel = QLabel("Clipping planes:") clippingPlanesLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) clipLayout = QGridLayout() clipLayout.addWidget(clippingLabel, 0, 0) clipLayout.addWidget(self.clippingCheckBox, 0, 1) clipLayout.addWidget(clippingPlanesLabel, 1, 0) clipLayout.addWidget(self.clippingPlanesCheckBox, 1, 1) clipLayout.addWidget(self.resetButton, 2, 0) self.clippingGroupBox = QGroupBox() self.clippingGroupBox.setTitle("Clipping box") self.clippingGroupBox.setLayout(clipLayout) # Create a nice layout for the labels layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.slicesGroupBox, 0, 0) layout.addWidget(self.clippingGroupBox, 0, 1) self.setLayout(layout) @Slot() def checkBoxChanged(self): """ Callback function for the check boxes. """ for index in range(3): showCheckBox = self.sliceCheckBoxes[index].checkState( ) == Qt.Checked self.renderController.setSliceVisibility(index, showCheckBox) @Slot(object) def setSlices(self, slices): for index in range(len(slices)): checkBox = self.sliceCheckBoxes[index] checkBox.setChecked(slices[index]) @Slot() def clippingCheckBoxChanged(self): """ Callback function for the clipping check box. """ self.renderController.showClippingBox( self.clippingCheckBox.checkState() == Qt.Checked) @Slot() def clippingPlanesCheckBoxChanged(self): """ Callback function for the clipping check box. """ self.renderController.showClippingPlanes( self.clippingPlanesCheckBox.checkState() == Qt.Checked) @Slot() def resetClippingBox(self): self.renderController.resetClippingBox() @Slot(bool) def showsClippingBox(self, show): self.clippingCheckBox.setChecked(show) @Slot(bool) def showsClippingPlanes(self, show): self.clippingPlanesCheckBox.setChecked(show)
class Ui_editTeamDialog(object): def setupUi(self, editTeamDialog): editTeamDialog.setObjectName("editTeamDialog") editTeamDialog.setMinimumSize(QSize(500, 550)) editTeamDialog.setMaximumSize(QSize(500, 550)) self.mainVerticalLayout = QVBoxLayout(editTeamDialog) self.topLayout = QHBoxLayout() self.teamUserInfoLayout = QGridLayout() managerLabel = QLabel() self.teamUserInfoLayout.addWidget(managerLabel, 0, 0) teamLabel = QLabel() self.teamUserInfoLayout.addWidget(teamLabel, 1, 0) self.teamNameEdit = QLineEdit() self.teamNameEdit.setMinimumWidth(200) self.teamUserInfoLayout.addWidget(self.teamNameEdit, 1, 1) emailLabel = QLabel() self.teamUserInfoLayout.addWidget(emailLabel, 2, 0) self.emailEdit = QLineEdit() self.teamUserInfoLayout.addWidget(self.emailEdit, 2, 1) self.topLayout.addLayout(self.teamUserInfoLayout) self.topLayout.addStretch() self.mainVerticalLayout.addLayout(self.topLayout) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) #self.mainVerticalLayout.addStretch() self.formationLayout = QHBoxLayout() self.formationRadioButtons = RadioButtonGroup("Formation", Formation.formations) self.formationRadioButtons.setFlat(True) self.formationLayout.addWidget(self.formationRadioButtons) self.formationLayout.addStretch() self.mainVerticalLayout.addLayout(self.formationLayout) self.playersGroupBox = QGroupBox() self.gridLayout = QGridLayout(self.playersGroupBox) self.goalkeeperLabel = QLabel(self.playersGroupBox) self.gridLayout.addWidget(self.goalkeeperLabel, 0, 0) self.positionLabels = [QLabel(self.playersGroupBox) for i in range(11)] self.searchBoxes = [QLineEdit(self.playersGroupBox) for i in range(11)] self.selections = [QComboBox(self.playersGroupBox) for i in range(11)] self.clubLabels = [QLabel(self.playersGroupBox) for i in range(11)] self.valueLabels = [QLabel(self.playersGroupBox) for i in range(11)] for i, positionLabel in enumerate(self.positionLabels): self.gridLayout.addWidget(positionLabel, i, 0) for i, searchBox in enumerate(self.searchBoxes): searchBox.setToolTip("Search for a player by code or name") self.gridLayout.addWidget(searchBox, i, 1) searchBox.returnPressed.connect(partial(self.playerSearch, i)) for i, selection in enumerate(self.selections): selection.setToolTip("Select a player") selection.setSizeAdjustPolicy(QComboBox.AdjustToContentsOnFirstShow) selection.setCurrentIndex(-1) self.gridLayout.addWidget(selection, i, 2) clubWidth = self.clubLabels[0].fontMetrics().width("Wolverhampton Wanderers") for i, clubLabel in enumerate(self.clubLabels): clubLabel.setFixedWidth(clubWidth) self.gridLayout.addWidget(clubLabel, i, 3) valueWidth = self.valueLabels[0].fontMetrics().width("0.0") for i, valueLabel in enumerate(self.valueLabels): valueLabel.setFixedWidth(valueWidth) self.gridLayout.addWidget(valueLabel, i, 4) self.mainVerticalLayout.addWidget(self.playersGroupBox) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) self.totalCostLayout = QHBoxLayout() self.totalCostLabel = QLabel() self.totalCostLayout.addWidget(self.totalCostLabel) self.mainVerticalLayout.addLayout(self.totalCostLayout) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) self.buttonLayout = QHBoxLayout() okButton = QPushButton("OK") okButton.setAutoDefault(False) cancelButton = QPushButton("Cancel") cancelButton.setAutoDefault(False) self.buttonLayout.addWidget(okButton) self.buttonLayout.addWidget(cancelButton) buttonSpacer = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum) self.buttonLayout.addItem(buttonSpacer) self.mainVerticalLayout.addLayout(self.buttonLayout) okButton.clicked.connect(editTeamDialog.accept) cancelButton.clicked.connect(editTeamDialog.reject) managerLabel.setText("Manager") teamLabel.setText("Team Name") emailLabel.setText("Email") self.playersGroupBox.setTitle("Players") for formationRadioButton in self.formationRadioButtons: formationRadioButton.clicked.connect(partial(self.formationChanged, str(formationRadioButton.text()))) self.totalCostLabel.setText("Total Cost")
class RenderSlicerParamWidget(QWidget): """ RenderSlicerParamWidget shows parameters with which slicers can be manipulated. """ def __init__(self, renderController, parent=None): super(RenderSlicerParamWidget, self).__init__(parent=parent) self.renderController = renderController self.renderController.slicesChanged.connect(self.setSlices) self.renderController.clippingBoxChanged.connect(self.showsClippingBox) self.renderController.clippingPlanesChanged.connect(self.showsClippingPlanes) self.sliceLabelTexts = ["Axial:", "Coronal:", "Sagittal:"] self.sliceLabels = [QLabel(text) for text in self.sliceLabelTexts] self.sliceCheckBoxes = [QCheckBox() for i in range(3)] for index in range(3): self.sliceCheckBoxes[index].clicked.connect(self.checkBoxChanged) self.sliceLabels[index].setAlignment(Qt.AlignRight | Qt.AlignVCenter) self.sliceCheckBoxes[index].setEnabled(True) slicesLayout = QGridLayout() slicesLayout.setAlignment(Qt.AlignTop) for index in range(3): slicesLayout.addWidget(self.sliceLabels[index], index+1, 0) slicesLayout.addWidget(self.sliceCheckBoxes[index], index+1, 1) self.slicesGroupBox = QGroupBox() self.slicesGroupBox.setTitle("Visible slices") self.slicesGroupBox.setLayout(slicesLayout) # Create option to show clipping box self.clippingCheckBox = QCheckBox() self.clippingCheckBox.setChecked(self.renderController.clippingBox) self.clippingCheckBox.clicked.connect(self.clippingCheckBoxChanged) self.clippingPlanesCheckBox = QCheckBox() self.clippingPlanesCheckBox.setChecked(self.renderController.clippingPlanes) self.clippingPlanesCheckBox.clicked.connect(self.clippingPlanesCheckBoxChanged) self.resetButton = QPushButton("Reset") self.resetButton.clicked.connect(self.resetClippingBox) clippingLabel = QLabel("Clipping box:") clippingLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) clippingPlanesLabel = QLabel("Clipping planes:") clippingPlanesLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter) clipLayout = QGridLayout() clipLayout.addWidget(clippingLabel, 0, 0) clipLayout.addWidget(self.clippingCheckBox, 0, 1) clipLayout.addWidget(clippingPlanesLabel, 1, 0) clipLayout.addWidget(self.clippingPlanesCheckBox, 1, 1) clipLayout.addWidget(self.resetButton, 2, 0) self.clippingGroupBox = QGroupBox() self.clippingGroupBox.setTitle("Clipping box") self.clippingGroupBox.setLayout(clipLayout) # Create a nice layout for the labels layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.slicesGroupBox, 0, 0) layout.addWidget(self.clippingGroupBox, 0, 1) self.setLayout(layout) @Slot() def checkBoxChanged(self): """ Callback function for the check boxes. """ for index in range(3): showCheckBox = self.sliceCheckBoxes[index].checkState() == Qt.Checked self.renderController.setSliceVisibility(index, showCheckBox) @Slot(object) def setSlices(self, slices): for index in range(len(slices)): checkBox = self.sliceCheckBoxes[index] checkBox.setChecked(slices[index]) @Slot() def clippingCheckBoxChanged(self): """ Callback function for the clipping check box. """ self.renderController.showClippingBox(self.clippingCheckBox.checkState() == Qt.Checked) @Slot() def clippingPlanesCheckBoxChanged(self): """ Callback function for the clipping check box. """ self.renderController.showClippingPlanes(self.clippingPlanesCheckBox.checkState() == Qt.Checked) @Slot() def resetClippingBox(self): self.renderController.resetClippingBox() @Slot(bool) def showsClippingBox(self, show): self.clippingCheckBox.setChecked(show) @Slot(bool) def showsClippingPlanes(self, show): self.clippingPlanesCheckBox.setChecked(show)
class optdlg(QDialog): def __init__(self, parent=None): super(optdlg, self).__init__(parent) self.setFixedSize(484, 399) appicom = QIcon(":/icons/njnlogo.png") self.setWindowIcon(appicom) self.setWindowTitle("Nigandu English to Tamil Dictionary | OPTIONS") self.buttonBox = QDialogButtonBox(self) self.buttonBox.setEnabled(True) self.buttonBox.setGeometry(QRect(350, 20, 121, 200)) self.buttonBox.setOrientation(Qt.Vertical) self.buttonBox.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel|QDialogButtonBox.Ok) self.buttonBox.setCenterButtons(True) self.restorebtn = QPushButton(self) self.restorebtn.setGeometry(QRect(354, 360, 121, 23)) self.restorebtn.setText("&RestoreDefults") self.fontbox = QGroupBox(self) self.fontbox.setGeometry(QRect(10, 10, 331, 141)) self.spinBox = QSpinBox(self.fontbox) self.spinBox.setGeometry(QRect(100, 20, 81, 21)) self.spinBox.setMinimum(10) self.spinBox.setMaximum(24) self.label = QLabel(self.fontbox) self.label.setGeometry(QRect(20, 20, 71, 21)) self.label.setText("Font Size:") self.fontbox.setTitle("Font") self.samplefontbox = QGroupBox(self) self.samplefontbox.setGeometry(QRect(20, 50, 291, 91)) self.samplefontbox.setTitle("Sample Text") self.sampletxt = QLabel(self.samplefontbox) self.sampletxt.setGeometry(QRect(20, 20, 251, 61)) self.sampletxt.setText("AaBbCcDdEeFfGgHhIiJjKkLlYyZz") self.clipbox = QGroupBox(self) self.clipbox.setGeometry(QRect(10, 160, 331, 61)) self.clipbox.setTitle("ClipBoard Options") self.checkclip = QCheckBox(self.clipbox) self.checkclip.setGeometry(QRect(20, 20, 301, 31)) self.checkclip.setText("Allow copy from clipboard on start-up") self.histbox = QGroupBox(self) self.histbox.setGeometry(QRect(10, 230, 331, 91)) self.histbox.setTitle("History") self.checkshowhistdock = QCheckBox(self.histbox) self.checkshowhistdock.setGeometry(QRect(20, 60, 301, 17)) self.checkshowhistdock.setText("Show History Dock on the right side") self.checkdelhist = QCheckBox(self.histbox) self.checkdelhist.setGeometry(QRect(20, 30, 301, 17)) self.checkdelhist.setText("Clear all the past history records") self.bkmbox = QGroupBox(self) self.bkmbox.setGeometry(QRect(10, 330, 331, 61)) self.bkmbox.setTitle("Book Marks") self.checkshowbkmdock = QCheckBox(self.bkmbox) self.checkshowbkmdock.setGeometry(QRect(20, 30, 301, 17)) self.checkshowbkmdock.setText("Show Book Marks Dock on the right side.") self.spinBox.valueChanged[int].connect(self.setsampletxt) self.restorebtn.clicked.connect(self.setdeafults) self.buttonBox.rejected.connect(self.close) def setdeafults(self): self.spinBox.setValue(13) self.checkshowhistdock.setChecked(True) self.checkshowbkmdock.setChecked(True) self.checkclip.setChecked(True) self.checkdelhist.setChecked(False) def setsampletxt(self, i): font = QFont() font.setPixelSize(i) self.sampletxt.setFont(font)
class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(560, 560) sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) Form.setMinimumSize(QtCore.QSize(0, 0)) self.gridLayout_2 = QGridLayout(Form) self.gridLayout_2.setObjectName("gridLayout_2") self.editorGroupBox = QGroupBox(Form) sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.editorGroupBox.sizePolicy().hasHeightForWidth()) self.editorGroupBox.setSizePolicy(sizePolicy) self.editorGroupBox.setMinimumSize(QtCore.QSize(0, 0)) self.editorGroupBox.setObjectName("editorGroupBox") self.gridLayout_3 = QGridLayout(self.editorGroupBox) self.gridLayout_3.setObjectName("gridLayout_3") self.gridLayout = QGridLayout() self.gridLayout.setObjectName("gridLayout") self.variable_verticalLayout_1 = QVBoxLayout() self.variable_verticalLayout_1.setObjectName( "variable_verticalLayout_1") self.listBox = QListWidget(self.editorGroupBox) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.listBox.sizePolicy().hasHeightForWidth()) self.listBox.setSizePolicy(sizePolicy) self.listBox.setDragEnabled(True) self.listBox.setDragDropOverwriteMode(False) self.listBox.setDragDropMode(QAbstractItemView.InternalMove) self.listBox.setDefaultDropAction(QtCore.Qt.MoveAction) self.listBox.setAlternatingRowColors(True) self.listBox.setSelectionMode(QAbstractItemView.SingleSelection) self.listBox.setMovement(QListView.Snap) self.listBox.setResizeMode(QListView.Fixed) self.listBox.setSelectionRectVisible(False) self.listBox.setObjectName("listBox") self.variable_verticalLayout_1.addWidget(self.listBox) self.gridLayout.addLayout(self.variable_verticalLayout_1, 0, 0, 1, 1) self.variable_verticalLayout_2 = QVBoxLayout() self.variable_verticalLayout_2.setObjectName( "variable_verticalLayout_2") self.addButton = QPushButton(self.editorGroupBox) self.addButton.setObjectName("addButton") self.variable_verticalLayout_2.addWidget(self.addButton) self.editButton = QPushButton(self.editorGroupBox) self.editButton.setObjectName("editButton") self.variable_verticalLayout_2.addWidget(self.editButton) self.removeButton = QPushButton(self.editorGroupBox) self.removeButton.setObjectName("removeButton") self.variable_verticalLayout_2.addWidget(self.removeButton) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.variable_verticalLayout_2.addItem(spacerItem) self.upButton = QPushButton(self.editorGroupBox) self.upButton.setObjectName("upButton") self.variable_verticalLayout_2.addWidget(self.upButton) self.downButton = QPushButton(self.editorGroupBox) self.downButton.setObjectName("downButton") self.variable_verticalLayout_2.addWidget(self.downButton) spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.variable_verticalLayout_2.addItem(spacerItem1) self.variable_verticalLayout_2.setStretch(3, 1) self.variable_verticalLayout_2.setStretch(6, 1) self.gridLayout.addLayout(self.variable_verticalLayout_2, 0, 1, 1, 1) self.gridLayout.setColumnStretch(0, 1) self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setContentsMargins(15, 15, 15, 15) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem2) self.ok_pushButton = QPushButton(self.editorGroupBox) self.ok_pushButton.setObjectName("ok_pushButton") self.horizontalLayout.addWidget(self.ok_pushButton) self.cancel_pushButton = QPushButton(self.editorGroupBox) self.cancel_pushButton.setObjectName("cancel_pushButton") self.horizontalLayout.addWidget(self.cancel_pushButton) self.horizontalLayout.setStretch(0, 1) self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.gridLayout_2.addWidget(self.editorGroupBox, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form) def retranslateUi(self, Form): Form.setWindowTitle( QApplication.translate("Form", "Form", None, QApplication.UnicodeUTF8)) self.editorGroupBox.setTitle( QApplication.translate("Form", "Maya Module Path Editor", None, QApplication.UnicodeUTF8)) self.addButton.setText( QApplication.translate("Form", "<<", None, QApplication.UnicodeUTF8)) self.editButton.setText( QApplication.translate("Form", "Edit", None, QApplication.UnicodeUTF8)) self.removeButton.setText( QApplication.translate("Form", ">>", None, QApplication.UnicodeUTF8)) self.upButton.setText( QApplication.translate("Form", "Move Up", None, QApplication.UnicodeUTF8)) self.downButton.setText( QApplication.translate("Form", "Move Down", None, QApplication.UnicodeUTF8)) self.ok_pushButton.setText( QApplication.translate("Form", "Save", None, QApplication.UnicodeUTF8)) self.cancel_pushButton.setText( QApplication.translate("Form", "Close", None, QApplication.UnicodeUTF8))
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 Ui_editTeamDialog(object): def setupUi(self, editTeamDialog): editTeamDialog.setObjectName("editTeamDialog") editTeamDialog.setMinimumSize(QSize(500, 550)) editTeamDialog.setMaximumSize(QSize(500, 550)) self.mainVerticalLayout = QVBoxLayout(editTeamDialog) self.topLayout = QHBoxLayout() self.teamUserInfoLayout = QGridLayout() managerLabel = QLabel() self.teamUserInfoLayout.addWidget(managerLabel, 0, 0) teamLabel = QLabel() self.teamUserInfoLayout.addWidget(teamLabel, 1, 0) self.teamNameEdit = QLineEdit() self.teamNameEdit.setMinimumWidth(200) self.teamUserInfoLayout.addWidget(self.teamNameEdit, 1, 1) emailLabel = QLabel() self.teamUserInfoLayout.addWidget(emailLabel, 2, 0) self.emailEdit = QLineEdit() self.teamUserInfoLayout.addWidget(self.emailEdit, 2, 1) self.topLayout.addLayout(self.teamUserInfoLayout) self.topLayout.addStretch() self.mainVerticalLayout.addLayout(self.topLayout) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) #self.mainVerticalLayout.addStretch() self.formationLayout = QHBoxLayout() self.formationRadioButtons = RadioButtonGroup("Formation", Formation.formations) self.formationRadioButtons.setFlat(True) self.formationLayout.addWidget(self.formationRadioButtons) self.formationLayout.addStretch() self.mainVerticalLayout.addLayout(self.formationLayout) self.playersGroupBox = QGroupBox() self.gridLayout = QGridLayout(self.playersGroupBox) self.goalkeeperLabel = QLabel(self.playersGroupBox) self.gridLayout.addWidget(self.goalkeeperLabel, 0, 0) self.positionLabels = [QLabel(self.playersGroupBox) for i in range(11)] self.searchBoxes = [QLineEdit(self.playersGroupBox) for i in range(11)] self.selections = [QComboBox(self.playersGroupBox) for i in range(11)] self.clubLabels = [QLabel(self.playersGroupBox) for i in range(11)] self.valueLabels = [QLabel(self.playersGroupBox) for i in range(11)] for i, positionLabel in enumerate(self.positionLabels): self.gridLayout.addWidget(positionLabel, i, 0) for i, searchBox in enumerate(self.searchBoxes): searchBox.setToolTip("Search for a player by code or name") self.gridLayout.addWidget(searchBox, i, 1) searchBox.returnPressed.connect(partial(self.playerSearch, i)) for i, selection in enumerate(self.selections): selection.setToolTip("Select a player") selection.setSizeAdjustPolicy( QComboBox.AdjustToContentsOnFirstShow) selection.setCurrentIndex(-1) self.gridLayout.addWidget(selection, i, 2) clubWidth = self.clubLabels[0].fontMetrics().width( "Wolverhampton Wanderers") for i, clubLabel in enumerate(self.clubLabels): clubLabel.setFixedWidth(clubWidth) self.gridLayout.addWidget(clubLabel, i, 3) valueWidth = self.valueLabels[0].fontMetrics().width("0.0") for i, valueLabel in enumerate(self.valueLabels): valueLabel.setFixedWidth(valueWidth) self.gridLayout.addWidget(valueLabel, i, 4) self.mainVerticalLayout.addWidget(self.playersGroupBox) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) self.totalCostLayout = QHBoxLayout() self.totalCostLabel = QLabel() self.totalCostLayout.addWidget(self.totalCostLabel) self.mainVerticalLayout.addLayout(self.totalCostLayout) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) self.buttonLayout = QHBoxLayout() okButton = QPushButton("OK") okButton.setAutoDefault(False) cancelButton = QPushButton("Cancel") cancelButton.setAutoDefault(False) self.buttonLayout.addWidget(okButton) self.buttonLayout.addWidget(cancelButton) buttonSpacer = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum) self.buttonLayout.addItem(buttonSpacer) self.mainVerticalLayout.addLayout(self.buttonLayout) okButton.clicked.connect(editTeamDialog.accept) cancelButton.clicked.connect(editTeamDialog.reject) managerLabel.setText("Manager") teamLabel.setText("Team Name") emailLabel.setText("Email") self.playersGroupBox.setTitle("Players") for formationRadioButton in self.formationRadioButtons: formationRadioButton.clicked.connect( partial(self.formationChanged, str(formationRadioButton.text()))) self.totalCostLabel.setText("Total Cost")
class Ui_MainWindow(QMainWindow): """Cette classe contient tous les widgets de notre application.""" defaultPalette = QPalette() defaultPalette.setColor(QPalette.Base, QColor("#151515")) defaultPalette.setColor(QPalette.Text, Qt.white) def __init__(self): super(Ui_MainWindow, self).__init__() # initialise la GUI avec un exemple self.text = "Ceci est un petit texte d'exemple." # les variables sont en place, initialise la GUI self.initUI() # exécute l'exemple self.orgText.setText(self.text) self.encode_text(False) self.logLab.setText( u"Saisir du texte ou importer un fichier, puis pousser \n" u"le bouton correspondant à l'opération souhaitée.") def initUI(self): """Met en place les éléments de l'interface.""" # -+++++++------------------- main window -------------------+++++++- # self.setWindowTitle(u"Encodage / Décodage de Huffman") self.centerAndResize() centralwidget = QWidget(self) mainGrid = QGridLayout(centralwidget) mainGrid.setColumnMinimumWidth(0, 450) # -+++++++------------------ groupe analyse -----------------+++++++- # analysGroup = QGroupBox(u"Analyse", centralwidget) self.analysGrid = QGridLayout(analysGroup) # ----------- groupe de la table des codes ---------- # codeTableGroup = QGroupBox(u"Table des codes", analysGroup) codeTableGrid = QGridLayout(codeTableGroup) # un tableau pour les codes self.codesTableModel = MyTableModel() self.codesTable = QTableView(codeTableGroup) self.codesTable.setModel(self.codesTableModel) self.codesTable.setFont(QFont("Mono", 8)) self.codesTable.resizeColumnsToContents() self.codesTable.setSortingEnabled(True) codeTableGrid.addWidget(self.codesTable, 0, 0, 1, 1) self.analysGrid.addWidget(codeTableGroup, 1, 0, 1, 1) # ----------- label du ratio de compression ---------- # self.ratioLab = QLabel(u"Ratio de compression: ", analysGroup) font = QFont() font.setBold(True) font.setWeight(75) font.setKerning(True) self.ratioLab.setFont(font) self.analysGrid.addWidget(self.ratioLab, 2, 0, 1, 1) # -+++++++-------- groupe de la table de comparaison --------+++++++- # self.compGroup = QGroupBox(analysGroup) self.compGroup.setTitle(u"Comparaisons") compGrid = QGridLayout(self.compGroup) # un tableau pour le ratio self.compTable = QTableWidget(self.compGroup) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.compTable.sizePolicy().hasHeightForWidth()) self.compTable.setSizePolicy(sizePolicy) self.compTable.setBaseSize(QSize(0, 0)) font = QFont() font.setWeight(50) self.compTable.setFont(font) self.compTable.setEditTriggers(QAbstractItemView.NoEditTriggers) self.compTable.setShowGrid(True) self.compTable.setGridStyle(Qt.SolidLine) # lignes / colonnes self.compTable.setColumnCount(2) self.compTable.setRowCount(3) self.compTable.setVerticalHeaderItem(0, QTableWidgetItem("Taille (bits)")) self.compTable.setVerticalHeaderItem(1, QTableWidgetItem("Entropie")) self.compTable.setVerticalHeaderItem(2, QTableWidgetItem("Taille moy. (bits)")) for i in range(2): self.compTable.verticalHeaderItem(i).setTextAlignment( Qt.AlignRight) self.compTable.setHorizontalHeaderItem(0, QTableWidgetItem("ASCII")) self.compTable.setHorizontalHeaderItem(1, QTableWidgetItem("Huffman")) # nom des items self.compTabASCIIMem = QTableWidgetItem() self.compTable.setItem(0, 0, self.compTabASCIIMem) self.compTabASCIIEnt = QTableWidgetItem() self.compTable.setItem(1, 0, self.compTabASCIIEnt) self.compTabASCIIAvg = QTableWidgetItem() self.compTable.setItem(2, 0, self.compTabASCIIAvg) self.compTabHuffMem = QTableWidgetItem() self.compTable.setItem(0, 1, self.compTabHuffMem) self.compTabHuffEnt = QTableWidgetItem() self.compTable.setItem(1, 1, self.compTabHuffEnt) self.compTabHuffAvg = QTableWidgetItem() self.compTable.setItem(2, 1, self.compTabHuffAvg) # parem du tableau self.compTable.horizontalHeader().setCascadingSectionResizes(False) self.compTable.verticalHeader().setVisible(True) font = QFont("Mono", 8) self.compTable.setFont(font) compGrid.addWidget(self.compTable, 1, 0, 1, 1) self.analysGrid.addWidget(self.compGroup, 0, 0, 1, 1) mainGrid.addWidget(analysGroup, 0, 1, 1, 1) # -+++++++----------------- groupe du texte -----------------+++++++- # groupBox = QGroupBox(u"Texte", centralwidget) textGrid = QGridLayout(groupBox) # -+++++++------------- groupe du texte original ------------+++++++- # orgTextGroup = QGroupBox(u"Texte original (Ctrl+T)", groupBox) orgTextGrid = QGridLayout(orgTextGroup) self.orgText = QTextEdit(orgTextGroup) self.orgText.setPalette(self.defaultPalette) orgTextGrid.addWidget(self.orgText, 0, 0, 1, 1) textGrid.addWidget(orgTextGroup, 0, 0, 1, 2) # -+++++++------------ groupe du texte compressé ------------+++++++- # compressedTextGroup = QGroupBox(u"Texte compressé (Ctrl+H)", groupBox) compressedTextGrid = QGridLayout(compressedTextGroup) self.compressedText = QTextEdit(compressedTextGroup) self.compressedText.setPalette(self.defaultPalette) compressedTextGrid.addWidget(self.compressedText, 0, 0, 1, 1) textGrid.addWidget(compressedTextGroup, 1, 0, 1, 2) # -+++++++------------ groupe pour le texte ascii -----------+++++++- # asciiTextGroup = QGroupBox(u"Texte ASCII", groupBox) asciiTextGrid = QGridLayout(asciiTextGroup) self.asciiText = QTextBrowser(asciiTextGroup) self.asciiText.setPalette(self.defaultPalette) asciiTextGrid.addWidget(self.asciiText, 0, 0, 1, 1) textGrid.addWidget(asciiTextGroup, 2, 0, 1, 2) # -+++++++-------------------- label de log -----------------+++++++- # self.logLab = QLabel(analysGroup) textGrid.addWidget(self.logLab, 3, 0, 1, 2) # -+++++++----------- bouton pour encoder le texte ----------+++++++- # self.encodeBut = QPushButton(groupBox) self.encodeBut.setStatusTip( u"Cliquez sur ce bouton pour encoder le texte original.") self.encodeBut.setText(u"ENCODER") self.encodeBut.clicked.connect(self.encode_text) textGrid.addWidget(self.encodeBut, 4, 0, 1, 1) # -+++++++----------- bouton pour décoder le texte ----------+++++++- # self.decodeBut = QPushButton(groupBox) self.decodeBut.setStatusTip( u"Cliquez sur ce bouton pour décoder le texte compressé.") self.decodeBut.setText(u"DÉCODER") self.decodeBut.clicked.connect(self.decode_text) textGrid.addWidget(self.decodeBut, 4, 1, 1, 1) mainGrid.addWidget(groupBox, 0, 0, 1, 1) self.setCentralWidget(centralwidget) # -+++++++--------------- une barre de statut ---------------+++++++- # self.setStatusBar(QStatusBar(self)) # -+++++++--------------------- le menu ---------------------+++++++- # self.fileMenu = QMenu(u"Fichier") self.fileMenu.addAction(u"Importer un texte...", self.open_text) self.fileMenu.addAction( u"Importer un texte encodé...", lambda: self.open_text(True)) self.fileMenu.addAction(u"Importer un dictionnaire...", self.open_dict) self.fileMenu.addAction(u"Enregistrer le dictionnaire...", self.save_dict) self.fileMenu.addAction(u"Quitter", self.close) self.menuBar().addMenu(self.fileMenu) QMetaObject.connectSlotsByName(self) def open_text(self, compressed=False): """Ouvrir un fichier contenant un texte compressé ou non.""" fname, _ = QFileDialog.getOpenFileName(self, u'Ouvrir') f = open(fname, 'r') with f: data = f.read() if compressed: self.compressedText.setText(data) else: self.orgText.setText(data) def open_dict(self): """Ouvrir un dictionnaire de codes Huffman.""" fname, _ = QFileDialog.getOpenFileName(self, u'Ouvrir') self.occ = {} self.hCodes = {} self.aCodes = {} self.hCost = {} self.aCost = {} self.hCodes = create_dict_from_file(fname) self.update_codes_table() self.logLab.setText(u"Dictionnaire de Huffman importé.") return self.hCodes def save_dict(self): """Enregistrer le dictionnaire de codes Huffman.""" fname, _ = QFileDialog.getSaveFileName(self, "Enregistrer sous") save_dict_to_file(fname, self.hCodes) def make_tab_rows(self): """Génère le remplissage des lignes du tableau des codes.""" dictList = [self.occ, self.aCodes, self.hCodes, self.aCost, self.hCost] tabList = [] charList = self.hCodes.keys() if self.hCodes else self.occ.keys() for char in charList: l = ["'" + char + "'"] for dic in dictList: try: l.append(dic[char]) except KeyError: l.append('') tabList.append(l) return tabList def encode_text(self, wizard=True): """Encode le texte original.""" self.text = self.orgText.toPlainText().encode('utf-8') if not self.text: self.compressedText.setText(u"") self.asciiText.setText(u"") self.logLab.setText( u"<font color=#A52A2A>Rien à compresser.</font>") return self.occ = {} self.tree = () self.hCodes = {} self.aCodes = {} self.hCost = {} self.aCost = {} self.hSqueezed = [] self.aSqueezed = [] self.stringHSqueezed = '' self.stringASqueezed = '' if wizard: self.launch_wizard( EncodeWizard(self), u"<font color=#008000>Compression achevée.</font>") else: self.make_occ() self.make_tree() self.make_codes() self.make_cost() self.make_encoded_text() self.make_comp() def decode_text(self, wizard=True): """Décode le texte compressé.""" self.codeString = str( self.compressedText.toPlainText().replace(' ', '')) if not self.codeString or not self.hCodes: self.orgText.setText(u"") self.asciiText.setText(u"") if not self.codeString: self.logLab.setText( u"<font color=#A52A2A>Rien à décompresser.</font>") if not self.hCodes: self.logLab.setText( u"<font color=#A52A2A>Dictionnaire indisponible pour la décompression.</font>") return self.text = '' self.stringASqueezed = '' if wizard: self.launch_wizard( DecodeWizard(self), u"<font color=#008000>Texte décompressé.</font>") else: self.make_code_map() self.make_decoded_text() def launch_wizard(self, wizard, finishString): """Lance l'assistant d'en/décodage pour guider l'utilisateur. Cache les options inaccessibles pendant l'assistant. """ self.logLab.setText( u"<font color=#9E6A00>Opération en cours. " u"Suivre les indications.</font>") disItems = [self.orgText, self.compressedText, self.encodeBut, self.decodeBut, self.fileMenu.actions()[1], self.fileMenu.actions()[2], self.fileMenu.actions()[3]] for item in disItems: item.setEnabled(False) self.compGroup.setVisible(False) self.analysGrid.addWidget(wizard, 0, 0, 1, 1) res = wizard.exec_() if res: self.logLab.setText(finishString) else: self.logLab.setText( u"<font color=#A52A2A>Opération interrompue.</font>") for item in disItems: item.setEnabled(True) self.compGroup.setVisible(True) def update_ratio_lab(self): """Replace la valeur du label du ratio de compression.""" if not self.stringASqueezed: val = '/' else: val = (len(self.stringHSqueezed.replace(' ', '')) / float(len(self.stringASqueezed.replace(' ', '')))) self.ratioLab.setText(unicode('Taux de compression: ' + str(val))) def update_comp_table(self): """Met à jour le tableau de comparaison ASCII VS Huffman.""" self.compTabASCIIMem.setText(unicode(len(''.join(self.aSqueezed)))) self.compTabHuffMem.setText(unicode(len(''.join(self.hSqueezed)))) # entropie ? self.compTabASCIIEnt.setText('0') self.compTabHuffEnt.setText('0') self.compTabASCIIAvg.setText(unicode(8)) self.compTabHuffAvg.setText(unicode( average_code_length(self.hSqueezed))) self.compTable.resizeColumnsToContents() def update_codes_table(self, hlRow=[]): """Met à jour le tableau des codes et surligne les lignes de hlRow.""" self.codesTableModel.hlRow = hlRow self.codesTableModel.emptyTable() self.codesTableModel.fillTable(self.make_tab_rows()) self.codesTable.resizeColumnsToContents() def centerAndResize(self): """Centre et redimmensionne le widget.""" screen = QDesktopWidget().screenGeometry() self.resize(screen.width() / 1.6, screen.height() / 1.4) size = self.geometry() self.move( (screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) #===================== METHODS FOR EN/DECODE WIZARDS =====================# def make_encode_init(self): self.compressedText.setText(unicode(self.stringHSqueezed)) self.asciiText.setText(unicode(self.stringASqueezed)) self.orgText.setTextColor(QColor(Qt.darkGreen)) self.orgText.setText(unicode(self.text.decode('utf-8'))) self.update_codes_table() def make_occ(self): self.orgText.setTextColor(QColor(Qt.white)) self.orgText.setText(unicode(self.text.decode('utf-8'))) self.occ = occurences(self.text) self.update_codes_table([0, 1]) def make_tree(self): self.tree = make_trie(self.occ) self.update_codes_table() def make_codes(self): self.hCodes = make_codes(self.tree, {}) self.aCodes = make_ascii_codes(self.occ.keys(), {}) self.update_codes_table([2, 3]) def make_cost(self): self.hCost = tree_cost(self.hCodes, self.occ) self.aCost = tree_cost(self.aCodes, self.occ) self.update_codes_table([4, 5]) def make_encoded_text(self): self.hSqueezed = squeeze(self.text, self.hCodes) self.aSqueezed = squeeze(self.text, self.aCodes) self.stringHSqueezed = ' '.join(self.hSqueezed) self.stringASqueezed = ' '.join(self.aSqueezed) self.compressedText.setTextColor(QColor(Qt.darkGreen)) self.asciiText.setTextColor(QColor(Qt.darkYellow)) self.compressedText.setText(unicode(self.stringHSqueezed)) self.asciiText.setText(unicode(self.stringASqueezed)) self.update_codes_table() def make_comp(self): self.compressedText.setTextColor(QColor(Qt.white)) self.asciiText.setTextColor(QColor(Qt.white)) self.compressedText.setText(unicode(self.stringHSqueezed)) self.asciiText.setText(unicode(self.stringASqueezed)) self.update_codes_table() self.update_comp_table() self.update_ratio_lab() def make_decode_init(self): self.orgText.setText(unicode(self.text)) self.asciiText.setText(unicode(self.stringASqueezed)) self.compressedText.setTextColor(QColor(Qt.darkGreen)) self.compressedText.setText(self.compressedText.toPlainText()) def make_code_map(self): self.compressedText.setTextColor(QColor(Qt.white)) self.compressedText.setText(self.compressedText.toPlainText()) self.orgText.setText(unicode(self.text)) self.asciiText.setText(unicode(self.stringASqueezed)) self.codeMap = dict(zip(self.hCodes.values(), self.hCodes.keys())) self.update_codes_table([0, 3]) def make_decoded_text(self): self.unSqueezed = unsqueeze(self.codeString, self.codeMap) self.text = ''.join(self.unSqueezed) self.orgText.setTextColor(QColor(Qt.darkGreen)) self.orgText.setText(unicode(self.text.decode('utf-8'))) self.asciiText.setText(unicode(self.stringASqueezed)) self.update_codes_table() def make_ascii_decode(self): self.orgText.setTextColor(QColor(Qt.white)) self.orgText.setText(unicode(self.text.decode('utf-8'))) self.aCodes = make_ascii_codes(self.codeMap.values(), {}) self.aSqueezed = squeeze(self.text, self.aCodes) self.stringASqueezed = ' '.join(self.aSqueezed) self.occ = occurences(self.text) self.hCost = tree_cost(self.hCodes, self.occ) self.aCost = tree_cost(self.aCodes, self.occ) self.asciiText.setTextColor(QColor(Qt.darkGreen)) self.asciiText.setText(unicode(self.stringASqueezed)) self.update_codes_table([1, 2, 4, 5])
class Ui_MainWindow(object): 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) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QApplication.translate("MainWindow", "Email Link Extractor", None, QApplication.UnicodeUTF8)) self.login_gbox.setTitle(QApplication.translate("MainWindow", " Login", None, QApplication.UnicodeUTF8)) self.lb_presets.setText(QApplication.translate("MainWindow", "Server Presets", None, QApplication.UnicodeUTF8)) self.add_preset_btn.setText(QApplication.translate("MainWindow", "+", None, QApplication.UnicodeUTF8)) self.remove_preset_btn.setText(QApplication.translate("MainWindow", "-", None, QApplication.UnicodeUTF8)) self.lb_imap_server.setText(QApplication.translate("MainWindow", "IMAP Server", None, QApplication.UnicodeUTF8)) self.lb_ssl.setText(QApplication.translate("MainWindow", "SSL", None, QApplication.UnicodeUTF8)) self.ssl_cb.setText(QApplication.translate("MainWindow", "Port : 993", None, QApplication.UnicodeUTF8)) self.lb_adress.setText(QApplication.translate("MainWindow", "Adress", None, QApplication.UnicodeUTF8)) self.lb_pass.setText(QApplication.translate("MainWindow", "Password", None, QApplication.UnicodeUTF8)) self.connect_btn.setText(QApplication.translate("MainWindow", "Connect", None, QApplication.UnicodeUTF8)) self.lb_select_mailbox.setText(QApplication.translate("MainWindow", "Select Mailbox", None, QApplication.UnicodeUTF8)) self.search_gbox.setTitle(QApplication.translate("MainWindow", " Search Parameters", None, QApplication.UnicodeUTF8)) self.since_date_cb.setText(QApplication.translate("MainWindow", "Since", None, QApplication.UnicodeUTF8)) self.since_date_edit.setDisplayFormat(QApplication.translate("MainWindow", "dd-MMM-yyyy", None, QApplication.UnicodeUTF8)) self.before_date_cb.setText(QApplication.translate("MainWindow", "Before", None, QApplication.UnicodeUTF8)) self.before_date_edit.setDisplayFormat(QApplication.translate("MainWindow", "dd-MMM-yyyy", 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.lb_from.setText(QApplication.translate("MainWindow", "From", None, QApplication.UnicodeUTF8)) self.lb_to.setText(QApplication.translate("MainWindow", "To", 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.links_gbox.setTitle(QApplication.translate("MainWindow", " Links", None, QApplication.UnicodeUTF8)) self.export_html_btn.setText(QApplication.translate("MainWindow", "Export as HTML", None, QApplication.UnicodeUTF8)) self.export_txt_btn.setText(QApplication.translate("MainWindow", "Export as txt", None, QApplication.UnicodeUTF8)) self.log_gbox.setTitle(QApplication.translate("MainWindow", " Log", None, QApplication.UnicodeUTF8)) self.disconnect_btn.setText(QApplication.translate("MainWindow", "Disconnect", None, QApplication.UnicodeUTF8)) self.menu_file.setTitle(QApplication.translate("MainWindow", "File", None, QApplication.UnicodeUTF8)) self.menu_about.setTitle(QApplication.translate("MainWindow", "About", 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))