コード例 #1
0
ファイル: addaword.py プロジェクト: jnoortheen/nigandu
class addawrd(QDialog):
	def __init__(self, parent=None):
		super(addawrd, self).__init__(parent)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu | Add a word")
		self.setFixedSize(364, 188)

		self.horizontalLayoutWidget = QWidget(self)
		self.horizontalLayoutWidget.setGeometry(QRect(10, 10, 341, 61))
		self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")

		self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
		self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
		self.horizontalLayout.setObjectName("horizontalLayout")

		self.label = QLabel(self.horizontalLayoutWidget)
		self.label.setMinimumSize(QSize(70, 25))
		self.horizontalLayout.addWidget(self.label)
		self.label.setText("English Word:")

		self.lineEdit = QLineEdit(self.horizontalLayoutWidget)
		self.lineEdit.setEnabled(True)
		self.lineEdit.setMinimumSize(QSize(0, 25))
		self.lineEdit.setObjectName("lineEdit_2")
		self.horizontalLayout.addWidget(self.lineEdit)
		self.lineEdit.setFocus()

		self.buttonBox = QDialogButtonBox(self)
		self.buttonBox.setGeometry(QRect(10, 150, 341, 25))
		self.buttonBox.setMinimumSize(QSize(70, 25))
		self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Save)
		self.buttonBox.setObjectName("buttonBox")

		self.horizontalLayoutWidget_2 = QWidget(self)
		self.horizontalLayoutWidget_2.setGeometry(QRect(10, 80, 341, 61))
		self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
		self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2)
		self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
		self.horizontalLayout_2.setObjectName("horizontalLayout_2")

		self.label_2 = QLabel(self.horizontalLayoutWidget_2)
		self.label_2.setMinimumSize(QSize(70, 25))
		self.label_2.setObjectName("label_2")
		self.horizontalLayout_2.addWidget(self.label_2)
		self.label_2.setText("Tamil Word:")

		self.lineEdit_2 = QLineEdit(self.horizontalLayoutWidget_2)
		self.lineEdit_2.setMinimumSize(QSize(0, 25))
		self.lineEdit_2.setObjectName("lineEdit_3")
		self.horizontalLayout_2.addWidget(self.lineEdit_2)

		self.setTabOrder(self.lineEdit, self.lineEdit_2)
		self.setTabOrder(self.lineEdit_2, self.buttonBox)
コード例 #2
0
class AddPresetDialog(QDialog):
    def __init__(self, parent=None):
        super(AddPresetDialog, self).__init__(parent)

        self.setWindowTitle(self.tr("Add IMAP Server Preset"))
        self.resize(388, 125)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setGeometry(QRect(184, 80, 181, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setCenterButtons(False)
        self.save_btn = QPushButton("&Save")
        self.save_btn.setDefault(True)
        self.save_btn.setEnabled(False)
        self.cancel_btn = QPushButton(self.tr("&Cancel"))
        self.cancel_btn.setCheckable(True)
        self.cancel_btn.setAutoDefault(False)

        self.buttonBox.addButton(self.save_btn, QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(self.cancel_btn, QDialogButtonBox.RejectRole)

        self.preset_name_le = QLineEdit(self)
        self.preset_name_le.setGeometry(QRect(134, 12, 231, 20))
        self.lb_name = QLabel(self)
        self.lb_name.setGeometry(QRect(14, 16, 58, 14))
        self.lb_name.setText(self.tr("Name"))
        self.server_address_le = QLineEdit(self)
        self.server_address_le.setGeometry(QRect(134, 45, 231, 20))
        self.lb_server = QLabel(self)
        self.lb_server.setGeometry(QRect(14, 48, 81, 16))
        self.lb_server.setText(self.tr("IMAP Server"))
        self.lb_info = QLabel(self)
        self.lb_info.setGeometry(QRect(14, 90, 161, 16))
        self.lb_info.setText(self.tr("(SSL is always on.)"))

        self.buttonBox.accepted.connect(self.act_save_preset)
        self.buttonBox.rejected.connect(self.reject)

        self.init_settings()

        self.settings.beginGroup("Server Presets")
        self.presetNameList = []
        for preset in self.settings.allKeys():
            self.presetNameList.append(preset)
        self.settings.endGroup()

        self.preset_name_le.textChanged.connect(self.check_preset_name_availability)
        self.server_address_le.textChanged.connect(self.check_server_address)

    # ---------------------------------------------------------------------
    def init_settings(self):
        QCoreApplication.setOrganizationName("erdinc.me")
        QCoreApplication.setOrganizationDomain("erdinc.me")
        QCoreApplication.setApplicationName("IMAPLinkParser")
        self.settings = QSettings()
        # self.settings.clear()

    # ---------------------------------------------------------------------
    @Slot()
    def act_save_preset(self):
        try:
            self.settings.beginGroup("Server Presets")
            self.settings.setValue(self.preset_name_le.text(), self.server_address_le.text())
            self.settings.endGroup()
        except:
            self.reject()
        self.accept()

    # ---------------------------------------------------------------------
    @Slot(unicode)
    def check_preset_name_availability(self, text):
        if text in self.presetNameList:
            self.save_btn.setEnabled(False)
            self.lb_info.setText('<p style="color:red;">Preset name exists!')
        else:
            if self.server_address_le.text() and self.preset_name_le.text():
                self.save_btn.setEnabled(True)
                self.lb_info.setText(self.tr("(SSL is always on.)"))
            else:
                self.save_btn.setEnabled(False)
                self.lb_info.setText(self.tr("(SSL is always on.)"))

    # ---------------------------------------------------------------------
    @Slot(unicode)
    def check_server_address(self):
        if self.server_address_le.text():
            preset = self.preset_name_le.text()
            if preset and preset not in self.presetNameList:
                self.save_btn.setEnabled(True)
        else:
            self.save_btn.setEnabled(False)
コード例 #3
0
ファイル: options.py プロジェクト: jnoortheen/nigandu
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)