當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.hide方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.hide方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.hide方法的具體用法?Python QLineEdit.hide怎麽用?Python QLineEdit.hide使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.hide方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: StatusBar

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class StatusBar (QStatusBar):
	def __init__(self):
		super(StatusBar, self).__init__()

		self.__statusMessageLabel = QLabel(self)
		self.__statusDataLabel = QLabel(self)
		self.__commandLine = QLineEdit(self)

		self.addPermanentWidget(self.__statusMessageLabel, 1)
		self.addPermanentWidget(self.__commandLine, 1)
		self.addPermanentWidget(self.__statusDataLabel)

		self.__commandLine.hide()

	def setStatus(self, statusMessage, statusData, cursorPosition, cursorAnchor, eventFilter):
		commandMode = cursorPosition != -1
		self.__commandLine.setVisible(commandMode)
		self.__statusMessageLabel.setVisible(not commandMode)

		if commandMode:
			self.__commandLine.installEventFilter(eventFilter)
			self.__commandLine.setFocus()
			self.__commandLine.setText(statusMessage)
			self.__commandLine.setSelection(cursorPosition, cursorAnchor - cursorPosition)
		else:
			self.__statusMessageLabel.setText(statusMessage)

		self.__statusDataLabel.setText(statusData)
開發者ID:ahnan4arch,項目名稱:retext,代碼行數:30,代碼來源:fakevimeditor.py

示例2: OffsetRow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class OffsetRow(QWidget):
    def __init__(self):
        super(OffsetRow, self).__init__()
        self.layout = QHBoxLayout()
        self.layout.setContentsMargins(0,0,0,0)
        self.sign = QComboBox()
        self.sign.addItems(['-', '+'])
        self.amount = QLineEdit()
        self.amount.setInputMask('99999999')
        self.unit = QComboBox()
        self.unit.addItems(['sec', 'min', 'hrs', 'day'])
        self.layout.addWidget(self.sign)
        self.layout.addWidget(self.amount, stretch = 1)
        self.layout.addWidget(self.unit)

    def show(self):
        self.sign.show()
        self.amount.show()
        self.unit.show()

    def hide(self):
        self.sign.hide()
        self.amount.hide()
        self.unit.hide()

    def set_values(self, sign, amount, unit):
        self.sign.setCurrentText(sign)
        self.amount.setText(str(amount))
        self.unit.setCurrentText(unit)
開發者ID:bobev18,項目名稱:stujeditor,代碼行數:31,代碼來源:gui_classes.py

示例3: Header

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class Header(QHeaderView):

    def __init__(self, orientation=Qt.Horizontal, parent=None):
        super(Header, self).__init__(orientation, parent)
        self.editable = True
        self.setSectionsClickable(True)
        self.setSectionResizeMode(QHeaderView.ResizeToContents)
        self.line = QLineEdit(parent=self.viewport())
        self.line.setAlignment(Qt.AlignTop)
        self.line.setHidden(True)
        self.line.blockSignals(True)
        self.col = 0

        # Connections
        self.sectionDoubleClicked[int].connect(self.__edit)
        self.line.editingFinished.connect(self.__done_editing)

    def __edit(self, index):
        if not self.editable:
            return
        geo = self.line.geometry()
        geo.setWidth(self.sectionSize(index))
        geo.moveLeft(self.sectionViewportPosition(index))
        current_text = self.model().headerData(index, Qt.Horizontal,
                                               Qt.DisplayRole)
        self.line.setGeometry(geo)
        self.line.setHidden(False)
        self.line.blockSignals(False)
        self.line.setText(str(current_text))
        self.line.setFocus()
        self.line.selectAll()
        self.col = index

    def __done_editing(self):
        text = self.line.text()
        if not text.strip():
            # No debe ser vacío
            QMessageBox.critical(self, "Error",
                                 self.tr("El campo no debe ser vacío"))
            self.line.hide()
            return
        self.line.blockSignals(True)
        self.line.setHidden(False)
        self.model().setHeaderData(self.col, Qt.Horizontal, text,
                                   Qt.DisplayRole)
        self.line.setText("")
        self.line.hide()
        self.setCurrentIndex(QModelIndex())
開發者ID:yoshitomimaehara,項目名稱:pireal,代碼行數:50,代碼來源:view.py

示例4: Header

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class Header(QHeaderView):

    def __init__(self, orientation=Qt.Horizontal, parent=None):
        super(Header, self).__init__(orientation, parent)
        self.setSectionsClickable(True)
        self.setSectionResizeMode(QHeaderView.ResizeToContents)
        self.line = QLineEdit(parent=self.viewport())
        self.line.setAlignment(Qt.AlignTop)
        self.line.setHidden(True)
        self.line.blockSignals(True)
        self.col = 0

        # Connections
        self.sectionDoubleClicked[int].connect(self.__edit)
        self.line.editingFinished.connect(self.__done_editing)

    def __edit(self, index):
        geo = self.line.geometry()
        geo.setWidth(self.sectionSize(index))
        geo.moveLeft(self.sectionViewportPosition(index))
        current_text = self.model().headerData(index, Qt.Horizontal)
        self.line.setGeometry(geo)
        self.line.setHidden(False)
        self.line.blockSignals(False)
        self.line.setText(str(current_text))
        self.line.setFocus()
        self.line.selectAll()
        self.col = index

    def __done_editing(self):
        self.line.blockSignals(True)
        self.line.setHidden(False)
        text = self.line.text()
        self.model().setHeaderData(self.col, Qt.Horizontal, text)
        self.line.setText("")
        self.line.hide()
        self.setCurrentIndex(QModelIndex())
開發者ID:centaurialpha,項目名稱:pireal,代碼行數:39,代碼來源:custom_table.py

示例5: LabelLineEdit

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class LabelLineEdit(QWidget):
    def __init__(self, label=''):
        super(LabelLineEdit, self).__init__()
        self.layout = QHBoxLayout()
        self.layout.setContentsMargins(0,0,0,0)
        self.line_edit = QLineEdit()
        self.label = QLabel()
        self.label.setText(label)
        self.layout.addWidget(self.label)
        self.layout.addWidget(self.line_edit, stretch = 1)

    def show(self):
        self.line_edit.show()
        self.label.show()

    def hide(self):
        self.line_edit.hide()
        self.label.hide()

    def set_text(self, text):
        self.line_edit.setText(text)

    def text(self):
        return self.line_edit.text()
開發者ID:bobev18,項目名稱:stujeditor,代碼行數:26,代碼來源:gui_classes.py

示例6: converter_gui

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class converter_gui(QWidget):
    def __init__(self):
        super(converter_gui, self).__init__()
        self.con = converter.converter('/dev/ttyACM0')
        
        self.setWindowTitle('SiversIMA Converter Control')
        
        hbox = QVBoxLayout(self)

        self.bt_open = QPushButton('Connect', self)
        self.bt_open.clicked.connect(self.button_clicked)

        self.bt_tx_on = QPushButton('TX ON', self)
        self.bt_tx_on.hide()
        self.bt_rx_on = QPushButton('RX ON', self)
        self.bt_rx_on.hide()

        self.le_rx_freq = QLineEdit()
        self.le_rx_freq.hide()
        self.le_tx_freq = QLineEdit()
        self.le_tx_freq.hide()

        hbox.addWidget(self.bt_open)
        hbox.addWidget(self.bt_tx_on)
        hbox.addWidget(self.bt_rx_on)
        hbox.addWidget(self.le_tx_freq)
        hbox.addWidget(self.le_rx_freq)
        
        self.setLayout(hbox)
        self.show()

    def closeEvent(self, event):
        self.con.close()

    def button_clicked(self):
        self.con.open()
        tx_on = self.con.get_tx_on()
        rx_on = self.con.get_rx_on()
        tx_freq = self.con.get_tx_freq()
        rx_freq = self.con.get_rx_freq()
        
        self.bt_open.hide()

        self.le_rx_freq.setText(str(rx_freq))
        self.le_rx_freq.show()
        self.le_tx_freq.setText(str(tx_freq))
        self.le_tx_freq.show()
        

        if tx_on:
            self.bt_tx_on.setText('TX Off')
            self.bt_tx_on.show()
        else:
            self.bt_tx_on.setText('TX ON')
            self.bt_tx_on.show()
        if rx_on:
            self.bt_rx_on.setText('RX Off')
            self.bt_rx_on.show()
        else:
            self.bt_rx_on.setText('RX ON')
            self.bt_rx_on.show()
開發者ID:cschmol,項目名稱:gr-inets,代碼行數:63,代碼來源:converter_gui.py

示例7: ApolMainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]

#.........這裏部分代碼省略.........
                if self._permmap:
                    self._permmap.map_policy(self._policy)

    def select_permmap(self):
        filename = QFileDialog.getOpenFileName(self, "Open permission map file", ".")[0]
        if filename:
            try:
                self._permmap = PermissionMap(filename)
            except Exception as ex:
                self.error_msg.critical(self, "Permission map loading error", str(ex))
            else:

                if self._policy:
                    self._permmap.map_policy(self._policy)

    def choose_analysis(self):
        if not self._policy:
            self.error_msg.critical(self, "No open policy",
                                    "Cannot start a new analysis. Please open a policy first.")

            self.select_policy()

        if self._policy:
            # this check of self._policy is here in case someone
            # tries to start an analysis with no policy open, but then
            # cancels out of the policy file chooser or there is an
            # error opening the policy file.
            chooser = ChooseAnalysis(self, self._policy.mls)
            chooser.show()

    def create_new_analysis(self, tabtitle, tabclass):
        self.tab_counter += 1
        counted_name = "{0}: {1}".format(self.tab_counter, tabtitle)

        newtab = QWidget()
        newtab.setObjectName(counted_name)

        newanalysis = tabclass(newtab, self._policy, self._permmap)

        # create a vertical layout in the tab, place the analysis ui inside.
        tabLayout = QVBoxLayout()
        tabLayout.setContentsMargins(0, 0, 0, 0)
        tabLayout.addWidget(newanalysis)
        newtab.setLayout(tabLayout)

        index = self.AnalysisTabs.addTab(newtab, counted_name)
        self.AnalysisTabs.setTabToolTip(index, tabtitle)

    def tab_name_editor(self, index):
        if index >= 0:
            tab_area = self.AnalysisTabs.tabBar().tabRect(index)
            self.tab_editor.move(self.AnalysisTabs.mapToGlobal(tab_area.topLeft()))
            self.tab_editor.setText(self.AnalysisTabs.tabText(index))
            self.tab_editor.selectAll()
            self.tab_editor.show()
            self.tab_editor.setFocus()

    def close_active_tab(self):
        index = self.AnalysisTabs.currentIndex()
        if index >= 0:
            self.close_tab(index)

    def rename_active_tab(self):
        index = self.AnalysisTabs.currentIndex()
        if index >= 0:
            self.tab_name_editor(index)

    def close_tab(self, index):
        widget = self.AnalysisTabs.widget(index)
        widget.close()
        widget.deleteLater()
        self.AnalysisTabs.removeTab(index)

    def rename_tab(self):
        # this should never be negative since the editor is modal
        index = self.AnalysisTabs.currentIndex()

        self.tab_editor.hide()
        self.AnalysisTabs.setTabText(index, self.tab_editor.text())

    def copy(self):
        """Copy text from the currently-focused widget."""
        try:
            QApplication.instance().focusWidget().copy()
        except AttributeError:
            pass

    def cut(self):
        """Cut text from the currently-focused widget."""
        try:
            QApplication.instance().focusWidget().cut()
        except AttributeError:
            pass

    def paste(self):
        """Paste text into the currently-focused widget."""
        try:
            QApplication.instance().focusWidget().paste()
        except AttributeError:
            pass
開發者ID:stevedlawrence,項目名稱:setools,代碼行數:104,代碼來源:mainwindow.py

示例8: CreerSuite

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]

#.........這裏部分代碼省略.........



    def Creer(self):
##        self.parent.creer_feuille() # nouvelle feuille de travail
        # style des lignes :
        style, epaisseur = self._param_.style_suites_recurrentes
        kw_lignes = {"style": style, "epaisseur": epaisseur}

        # Les suites s'enregistrent auprès du module traceur
#        if not hasattr(self.parent, "suites"):
#            self.parent.suites = {}

        objets = self.parent.feuille_actuelle.objets
        i = self.fonction.currentIndex()
        nom_courbe = 'Cf' + str(i + 1)

        if nom_courbe in objets:
            courbe = objets[nom_courbe]
            fonction = courbe.fonction
        elif self.parent.boites[i].text():
            self.parent.valider(i=i)
            courbe = objets[nom_courbe]
            fonction = courbe.fonction
        else:
            # TODO: afficher un vrai message d'erreur
            raise KeyError("courbe inexistante : %s" %nom_courbe)


        if self.mode.currentIndex() == 0: # cas des suites définies par récurrence
            u0 = eval_safe(self.un0.text())
            n0 = self.n0.value()

            d = objets.suiteDroited = Droite(Point(0, 0), Point(1, 1))
            d.label("$y\ =\ x$")
            M = objets.suitePointM0 = Point(u0, 0)
            M.label("$u_%s$" %(n0))
#            self.parent.suites["u"] = [d, M]

            for i in range(self.termes.value() - 1):
                # (Attention, ça ne va pas marcher pour les fonctions définies par morceau)
                u1 = fonction(u0)
                N = Point(u0, u1, visible=self._param_.afficher_points_de_construction)
                N.etiquette.visible = False
                s = Segment(M, N, **kw_lignes)
                P = Point(0, u1)
                P.label("$u_%s$" %(i + n0 + 1))
                t = Segment(N, P, **kw_lignes)
                Q = Point(u1, u1, visible = self._param_.afficher_points_de_construction)
                Q.etiquette.visible = False
                r = Segment(P, Q, **kw_lignes)
                M = Point(u1, 0)
                M.label("$u_%s$" %(i + n0 + 1))
                #self.parent.suites[u"u"].append([M, N, P, s, t])
                setattr(objets, "SuitePointN" + str(i), N)
                setattr(objets, "suitePointP" + str(i), P)
                setattr(objets, "suitePointQ" + str(i), Q)
                setattr(objets, "suiteSegments" + str(i), s)
                setattr(objets, "suiteSegmentt" + str(i), t)
                setattr(objets, "suiteSegmentr" + str(i), r)
                setattr(objets, "suitePointM" + str(i + 1), M)
                a = Segment(Q, M, **kw_lignes)
                setattr(objets, "suiteSegmenta" + str(i), a)
                u0 = u1
            self.parent.canvas.zoom_auto()

        else:   # suites définies explicitement
            n0 = self.n0.value()
#            self.parent.suites[u"u"] = []
            for i in range(n0, n0 + self.termes.value()):
                yi = fonction(i)
                M = Point(i, 0)
                M.label(str(i))
                N = Point(i, yi)
                N.etiquette.visible = False
                P = Point(0, yi)
                P.label("$u_%s$" %i)
                s = Segment(M, N, **kw_lignes)
                t = Segment(N, P, **kw_lignes)
                setattr(objets, "suitePointM" + str(i), M)
                setattr(objets, "suitePointN" + str(i), N)
                setattr(objets, "suitePointP" + str(i), P)
                setattr(objets, "suiteSegments" + str(i), s)
                setattr(objets, "suiteSegmentt" + str(i), t)
            self.parent.canvas.zoom_auto()



    def EvtChoixMode(self, index):
        if index == 1:
            self.label_init.hide()
            self.un0.hide()
        else:
            self.un0.show()
            self.label_init.show()


    def EvtChoixFonction(self, index):
        for i in range(self.parent.nombre_courbes):
            self.parent.boites[i].setChecked(i==index)
開發者ID:wxgeo,項目名稱:geophar,代碼行數:104,代碼來源:suites.py

示例9: ApolMainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]

#.........這裏部分代碼省略.........
    def tab_name_editor(self, index):
        if index >= 0:
            tab_area = self.AnalysisTabs.tabBar().tabRect(index)
            self.tab_editor.move(self.AnalysisTabs.mapToGlobal(tab_area.topLeft()))
            self.tab_editor.setText(self.AnalysisTabs.tabText(index))
            self.tab_editor.selectAll()
            self.tab_editor.show()
            self.tab_editor.setFocus()

    def close_active_tab(self):
        """Close the active tab. This is called from the context menu."""
        index = self.AnalysisTabs.currentIndex()
        if index >= 0:
            self.close_tab(index)

    def rename_active_tab(self):
        """Rename the active tab."""
        index = self.AnalysisTabs.currentIndex()
        if index >= 0:
            self.tab_name_editor(index)

    def close_tab(self, index):
        """Close a tab specified by index."""
        widget = self.AnalysisTabs.widget(index)
        widget.close()
        self.AnalysisTabs.removeTab(index)

    def rename_tab(self):
        # this should never be negative since the editor is modal
        index = self.AnalysisTabs.currentIndex()
        tab = self.AnalysisTabs.widget(index)
        title = self.tab_editor.text()

        self.tab_editor.hide()

        self.AnalysisTabs.setTabText(index, title)
        tab.setObjectName(title)

    #
    # Workspace actions
    #
    def toggle_workspace_actions(self, index=-1):
        """
        Enable or disable workspace actions depending on
        how many tabs are open and if a policy is open.

        This is a slot for the QTabWidget.currentChanged()
        signal, though index is ignored.
        """
        open_tabs = self.AnalysisTabs.count() > 0
        open_policy = self._policy is not None

        self.log.debug("{0} actions requiring an open policy.".
                       format("Enabling" if open_policy else "Disabling"))
        self.log.debug("{0} actions requiring open tabs.".
                       format("Enabling" if open_tabs else "Disabling"))
        self.save_settings_action.setEnabled(open_tabs)
        self.save_workspace_action.setEnabled(open_tabs)
        self.new_analysis.setEnabled(open_policy)
        self.new_from_settings_action.setEnabled(open_policy)
        self.load_settings_action.setEnabled(open_tabs)

    def _get_settings(self, index=None):
        """Return a dictionary with the settings of the tab at the specified index."""
        if index is None:
            index = self.AnalysisTabs.currentIndex()
開發者ID:TresysTechnology,項目名稱:setools,代碼行數:70,代碼來源:mainwindow.py

示例10: create_data_rows

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
    def create_data_rows(self, layout):
        u"""Build one line of the dialog box."""
        gf_layout = QGridLayout()
        for num, field_data in enumerate(self.field_data_list):
            # We create all three QTextEdits for each item and hide
            # some according to field_data.split.
            label = QLabel(u'{0}:'.format(field_data.word_field_name))
            label.setToolTip(_(u'Source of the request text'))
            gf_layout.addWidget(label, num, 0)
            ledit = QLineEdit(field_data.word)
            self.word_lineedits.append(ledit)
            try:
                bedit = QLineEdit(field_data.kanji)
            except AttributeError:
                # Happens when FieldData is not a
                # JapaneseFieldData. LBYL would be to use
                # field_data.split
                bedit = QLineEdit('')
            self.kanji_lineedits.append(bedit)
            try:
                redit = QLineEdit(field_data.kana)
            except AttributeError:
                # dto.
                redit = QLineEdit('')
            self.kana_lineedits.append(redit)
            if not field_data.split:
                gf_layout.addWidget(ledit, num, 1, 1, 2)
                ledit.setToolTip(
                    _(u'''<h4>Text of the request.</h4>
<p>Edit this as appropriate.  Clear it to not download anything for
this line.</p>'''))
                bedit.hide()
                redit.hide()
            else:
                ledit.hide()
                gf_layout.addWidget(bedit, num, 1)
                kanji_tt_text = _(u'''\
<h4>Kanji of the request.</h4>
<p>Edit this as appropriate.  Clear this to not download anything for
this line.  For pure kana words, enter (or keep) the kana
here.</p>''')
                base_tt_text = _(u'''\
<h4>Expression of the request.</h4>
<p>Edit this as appropriate. Clear this to not download anything for
this line.</p>''')
                # A bit C-ish. language_code may be None.
                if self.language_code and self.language_code.startswith('ja'):
                    bedit.setToolTip(kanji_tt_text)
                else:
                    bedit.setToolTip(base_tt_text)
                gf_layout.addWidget(redit, num, 2)

                kana_tt_text = _(u'''<h4>Kana of the request.</h4>
<p>Edit this as appropriate.  For pure kana words, enter (or keep) the
kana here or clear this field.</p>''')
                ruby_tt_text = _(u'''<h4>Reading (ruby) of the request.</h4>
<p>Edit this as appropriate.</p>''')
                if self.language_code and self.language_code.startswith('ja'):
                    redit.setToolTip(kana_tt_text)
                else:
                    redit.setToolTip(ruby_tt_text)
        layout.addLayout(gf_layout)
開發者ID:ospalh,項目名稱:anki-addons,代碼行數:64,代碼來源:update_gui.py

示例11: GalleryDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class GalleryDialog(QWidget):
	"""
	A window for adding/modifying gallery.
	Pass a list of QModelIndexes to edit their data
	or pass a path to preset path
	"""

	gallery_queue = queue.Queue()
	SERIES = pyqtSignal(list)
	SERIES_EDIT = pyqtSignal(list, int)
	#gallery_list = [] # might want to extend this to allow mass gallery adding

	def __init__(self, parent=None, arg=None):
		super().__init__(parent, Qt.Dialog)
		self.setAttribute(Qt.WA_DeleteOnClose)
		self.parent_widget = parent
		log_d('Triggered Gallery Edit/Add Dialog')
		m_l = QVBoxLayout()
		self.main_layout = QVBoxLayout()
		dummy = QWidget(self)
		scroll_area = QScrollArea(self)
		scroll_area.setWidgetResizable(True)
		scroll_area.setFrameStyle(scroll_area.StyledPanel)
		dummy.setLayout(self.main_layout)
		scroll_area.setWidget(dummy)
		m_l.addWidget(scroll_area, 3)

		final_buttons = QHBoxLayout()
		final_buttons.setAlignment(Qt.AlignRight)
		m_l.addLayout(final_buttons)
		self.done = QPushButton("Done")
		self.done.setDefault(True)
		cancel = QPushButton("Cancel")
		final_buttons.addWidget(cancel)
		final_buttons.addWidget(self.done)

		def new_gallery():
			self.setWindowTitle('Add a new gallery')
			self.newUI()
			self.commonUI()
			self.done.clicked.connect(self.accept)
			cancel.clicked.connect(self.reject)

		if arg:
			if isinstance(arg, list):
				self.setWindowTitle('Edit gallery')
				self.position = arg[0].row()
				for index in arg:
					gallery = index.data(Qt.UserRole+1)
					self.commonUI()
					self.setGallery(gallery)
				self.done.clicked.connect(self.accept_edit)
				cancel.clicked.connect(self.reject_edit)
			elif isinstance(arg, str):
				new_gallery()
				self.choose_dir(arg)
		else:
			new_gallery()

		log_d('GalleryDialog: Create UI: successful')
		#TODO: Implement a way to mass add galleries
		#IDEA: Extend dialog in a ScrollArea with more forms...

		self.setLayout(m_l)
		self.resize(500,560)
		frect = self.frameGeometry()
		frect.moveCenter(QDesktopWidget().availableGeometry().center())
		self.move(frect.topLeft())
		#self.setAttribute(Qt.WA_DeleteOnClose)

	def commonUI(self):
		f_web = QGroupBox("Metadata from the Web")
		f_web.setCheckable(False)
		self.main_layout.addWidget(f_web)
		web_main_layout = QVBoxLayout()
		web_layout = QHBoxLayout()
		web_main_layout.addLayout(web_layout)
		f_web.setLayout(web_main_layout)

		f_gallery = QGroupBox("Gallery Info")
		f_gallery.setCheckable(False)
		self.main_layout.addWidget(f_gallery)
		gallery_layout = QFormLayout()
		f_gallery.setLayout(gallery_layout)

		def basic_web(name):
			return QLabel(name), QLineEdit(), QPushButton("Get metadata"), QProgressBar()

		url_lbl, self.url_edit, url_btn, url_prog = basic_web("URL:")
		url_btn.clicked.connect(lambda: self.web_metadata(self.url_edit.text(), url_btn,
											url_prog))
		url_prog.setTextVisible(False)
		url_prog.setMinimum(0)
		url_prog.setMaximum(0)
		web_layout.addWidget(url_lbl, 0, Qt.AlignLeft)
		web_layout.addWidget(self.url_edit, 0)
		web_layout.addWidget(url_btn, 0, Qt.AlignRight)
		web_layout.addWidget(url_prog, 0, Qt.AlignRight)
		self.url_edit.setPlaceholderText("Paste g.e-hentai/exhentai gallery url or just press the button.")
		url_prog.hide()
#.........這裏部分代碼省略.........
開發者ID:darmstard,項目名稱:happypanda,代碼行數:103,代碼來源:gallerydialog.py

示例12: LoginDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class LoginDialog(QDialog):
    login_success = pyqtSignal([object])

    def __init__(self, verify_captcha, verify_userpw, create_user, parent=None):
        super().__init__(parent)

        self.verify_captcha = verify_captcha
        self.verify_userpw = verify_userpw
        self.create_user = create_user

        self.is_encrypted = False
        self.captcha_needed = False
        self.captcha_id = 0

        self.username_input = QLineEdit(self)
        self.pw_input = QLineEdit(self)
        self.pw_input.setEchoMode(QLineEdit.Password)
        # self.remember_checkbox = FCheckBox(self)
        self.captcha_label = QLabel(self)
        self.captcha_label.hide()
        self.captcha_input = QLineEdit(self)
        self.captcha_input.hide()
        self.hint_label = QLabel(self)
        self.ok_btn = QPushButton('登錄', self)
        self._layout = QVBoxLayout(self)

        self.username_input.setPlaceholderText('網易郵箱或者手機號')
        self.pw_input.setPlaceholderText('密碼')

        self.pw_input.textChanged.connect(self.dis_encrypt)
        self.ok_btn.clicked.connect(self.login)

        self.setFixedWidth(200)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._layout.addWidget(self.username_input)
        self._layout.addWidget(self.pw_input)
        self._layout.addWidget(self.captcha_label)
        self._layout.addWidget(self.captcha_input)
        self._layout.addWidget(self.hint_label)
        # self._layout.addWidget(self.remember_checkbox)
        self._layout.addWidget(self.ok_btn)

    def fill(self, data):
        self.username_input.setText(data['username'])
        self.pw_input.setText(data['password'])
        self.is_encrypted = True

    def show_hint(self, text):
        self.hint_label.setText(text)

    @property
    def data(self):
        username = self.username_input.text()
        pw = self.pw_input.text()
        if self.is_encrypted:
            password = pw
        else:
            password = hashlib.md5(pw.encode('utf-8')).hexdigest()
        d = dict(username=username, password=password)
        return d

    def captcha_verify(self, data):
        self.captcha_needed = True
        url = data['captcha_url']
        self.captcha_id = data['captcha_id']
        self.captcha_input.show()
        self.captcha_label.show()
        # FIXME: get pixmap from url
        # self._app.pixmap_from_url(url, self.captcha_label.setPixmap)

    def dis_encrypt(self, text):
        self.is_encrypted = False

    def login(self):
        if self.captcha_needed:
            captcha = str(self.captcha_input.text())
            captcha_id = self.captcha_id
            data = self.check_captcha(captcha_id, captcha)
            if data['code'] == 200:
                self.captcha_input.hide()
                self.captcha_label.hide()
            else:
                self.captcha_verify(data)

        user_data = self.data
        self.show_hint('正在登錄...')
        data = self.verify_userpw(user_data['username'], user_data['password'])
        message = data['message']
        self.show_hint(message)
        if data['code'] == 200:
            self.save_user_pw(user_data)
            user = self.create_user(data)
            self.login_success.emit(user)
            self.hide()
        elif data['code'] == 415:
            self.captcha_verify(data)

    def save_user_pw(self, data):
        with open(USER_PW_FILE, 'w+') as f:
#.........這裏部分代碼省略.........
開發者ID:BruceZhang1993,項目名稱:FeelUOwn,代碼行數:103,代碼來源:ui.py

示例13: GalleryDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]

#.........這裏部分代碼省略.........
        self._fetch_inst = fetch.Fetch()
        self._fetch_thread = QThread(self)
        self._fetch_thread.setObjectName("GalleryDialog metadata thread")
        self._fetch_inst.moveToThread(self._fetch_thread)
        self._fetch_thread.started.connect(self._fetch_inst.auto_web_metadata)

    def commonUI(self):
        if not self._multiple_galleries:
            f_web = QGroupBox("Metadata from the Web")
            f_web.setCheckable(False)
            self.main_layout.addWidget(f_web)
            web_main_layout = QVBoxLayout()
            web_info = misc.ClickedLabel("Which gallery URLs are supported? (hover)", parent=self)
            web_info.setToolTip(app_constants.SUPPORTED_METADATA_URLS)
            web_info.setToolTipDuration(999999999)
            web_main_layout.addWidget(web_info)
            web_layout = QHBoxLayout()
            web_main_layout.addLayout(web_layout)
            f_web.setLayout(web_main_layout)
            def basic_web(name):
                return QLabel(name), QLineEdit(), QPushButton("Get metadata"), QProgressBar()

            url_lbl, self.url_edit, url_btn, url_prog = basic_web("URL:")
            url_btn.clicked.connect(lambda: self.web_metadata(self.url_edit.text(), url_btn,
                                                url_prog))
            url_prog.setTextVisible(False)
            url_prog.setMinimum(0)
            url_prog.setMaximum(0)
            web_layout.addWidget(url_lbl, 0, Qt.AlignLeft)
            web_layout.addWidget(self.url_edit, 0)
            web_layout.addWidget(url_btn, 0, Qt.AlignRight)
            web_layout.addWidget(url_prog, 0, Qt.AlignRight)
            self.url_edit.setPlaceholderText("Insert supported gallery URLs or just press the button!")
            url_prog.hide()

        f_gallery = QGroupBox("Gallery Info")
        f_gallery.setCheckable(False)
        self.main_layout.addWidget(f_gallery)
        gallery_layout = QFormLayout()
        f_gallery.setLayout(gallery_layout)

        def checkbox_layout(widget):
            if self._multiple_galleries:
                l = QHBoxLayout()
                l.addWidget(widget.g_check)
                widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
                l.addWidget(widget)
                return l
            else:
                widget.g_check.setChecked(True)
                widget.g_check.hide()
                return widget

        def add_check(widget):
            widget.g_check = QCheckBox(self)
            return widget

        self.title_edit = add_check(QLineEdit())
        self.author_edit = add_check(QLineEdit())
        author_completer = misc.GCompleter(self, False, True, False)
        author_completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.author_edit.setCompleter(author_completer)
        self.descr_edit = add_check(QTextEdit())
        self.descr_edit.setAcceptRichText(True)
        self.lang_box = add_check(QComboBox())
        self.lang_box.addItems(app_constants.G_LANGUAGES)
開發者ID:Pewpews,項目名稱:happypanda,代碼行數:70,代碼來源:gallerydialog.py

示例14: NewNodeBaseDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]
class NewNodeBaseDialog(QDialog):
    def __init__(self, parent, title, server):
        QDialog.__init__(self, parent)
        self.setWindowTitle(title)
        self.settings = QSettings()
        self.server = server

        self.vlayout = QVBoxLayout(self)
        self.layout = QHBoxLayout()
        self.vlayout.addLayout(self.layout)

        self.layout.addWidget(QLabel("ns:", self))

        self.nsComboBox = QComboBox(self)
        uries = server.get_namespace_array()
        for uri in uries:
            self.nsComboBox.addItem(uri)
        nsidx = int(self.settings.value("last_namespace", len(uries) - 1))
        if nsidx > len(uries) - 1:
            nsidx = len(uries) - 1
        self.nsComboBox.setCurrentIndex(nsidx)
        self.layout.addWidget(self.nsComboBox)

        self.layout.addWidget(QLabel("Name:", self))
        self.nameLabel = QLineEdit(self)
        self.nameLabel.setMinimumWidth(120)
        self.nameLabel.setText("NoName")
        self.layout.addWidget(self.nameLabel)
        self.nodeidCheckBox = QCheckBox("Auto NodeId", self)
        self.nodeidCheckBox.stateChanged.connect(self._show_nodeid)
        self.layout.addWidget(self.nodeidCheckBox)
        self.nodeidLineEdit = QLineEdit(self)
        self.nodeidLineEdit.setMinimumWidth(80)
        self.nodeidLineEdit.setText(self.settings.value("last_nodeid_prefix", "ns={};i=20000".format(nsidx)))
        self.layout.addWidget(self.nodeidLineEdit)

        # restore check box state from settings
        if self.settings.value("last_node_widget_vis", False) == "true":
            self.nodeidCheckBox.setChecked(False)
            self.nodeidLineEdit.show()
        else:
            self.nodeidCheckBox.setChecked(True)
            self.nodeidLineEdit.hide()

        self.buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        self.vlayout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.accepted.connect(self._store_state)
        self.buttons.rejected.connect(self.reject)

    def _store_state(self):
        self.settings.setValue("last_namespace", self.nsComboBox.currentIndex())
        self.settings.setValue("last_node_widget_vis", not self.nodeidCheckBox.isChecked())
        ns_nt = self.nodeidLineEdit.text().split(';')
        self.settings.setValue("last_nodeid_prefix", ns_nt[0] + ';' + ns_nt[1][0:2])

    def _show_nodeid(self, val):
        if val:
            self.nodeidLineEdit.hide()
        else:
            self.nodeidLineEdit.show()
        self.adjustSize()

    def get_nodeid_and_bname(self):
        ns = self.nsComboBox.currentIndex()
        name = self.nameLabel.text()
        bname = ua.QualifiedName(name, ns)
        if self.nodeidCheckBox.isChecked():
            nodeid = ua.NodeId(namespaceidx=ns)
        else:
            nodeid = ua.NodeId.from_string(self.nodeidLineEdit.text())
        return nodeid, bname

    def get_args(self):
        nodeid, bname = self.get_nodeid_and_bname()
        return nodeid, bname

    @classmethod
    def getArgs(cls, parent, title, server, *args, **kwargs):
        dialog = cls(parent, title, server, *args, **kwargs)
        result = dialog.exec_()
        if result == QDialog.Accepted:
            return dialog.get_args(), True
        else:
            return [], False
開發者ID:FreeOpcUa,項目名稱:opcua-widgets,代碼行數:88,代碼來源:new_node_dialogs.py

示例15: TabLaTeX

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import hide [as 別名]

#.........這裏部分代碼省略.........
                self.focus_widget = self.entree

        self.derivee.stateChanged.connect(regler_parametres)
        self.limites.stateChanged.connect(regler_parametres)
        self.formatage_images.editingFinished.connect(regler_parametres)
        self.decimales_tabvar_tabsign.valueChanged.connect(regler_decimales)
        self.decimales_tabval.valueChanged.connect(regler_decimales)

        self.focus_widget = self.entree


    def activer(self):
        Panel_simple.activer(self)
        # Actions à effectuer lorsque l'onglet devient actif
        self.entree.setFocus()


    def generer_code(self, commande, **kw):
        if not commande.strip():
            return
        # Utilisé pour la sauvegarde automatique:x+3

        self.modifie = True
        try:
            if self._param_.mode == 0:
                code_latex = tabvar(commande, derivee=self._param_.derivee,
                                    limites=self._param_.limites,
                                    decimales=self._param_.decimales_tabvar_tabsign,
                                    approche=(self._param_.decimales_tabvar_tabsign != -1))
            elif self._param_.mode == 1:
                code_latex = tabsign(commande, cellspace=self._param_.utiliser_cellspace,
                                    decimales=self._param_.decimales_tabvar_tabsign,
                                    approche=(self._param_.decimales_tabvar_tabsign != -1))
            elif self._param_.mode == 2:
                code_latex = tabval(commande,
                    formatage_antecedents=self._param_.formatage_antecedents,
                    formatage_images=self._param_.formatage_images,
                    precision=10**-self._param_.decimales_tabval)
            else:
                warning("Type de tableau non reconnu.")

            self.code_tableau.setText(code_latex)
            if self._param_.copie_automatique:
                self.vers_presse_papier(texte = code_latex)
            self.focus_widget.setFocus()
            self.message("Le code LaTeX a bien été généré.")
        except BaseException as erreur:
            self.message("Impossible de générer le code LaTeX. " + message(erreur))
            self.code_tableau.setText("<i><b>Erreur.</b> Impossible de générer le code LaTeX.</i>")
            self.entree.setFocus()
            if param.debug:
                raise


    def EvtChoix(self, event = None):
        self._param_.mode = self.type_tableau.currentIndex()
        # Tableaux de variations
        if self._param_.mode == 0:
            self.code_entete.setText("\\usepackage{tabvar}")
            self.entree.setToolTip(tabvar.__doc__)
            self.utiliser_cellspace.hide()
            self.derivee.show()
            self.limites.show()
            self.decimales_tabvar_tabsign.show()
            self.formatage_images.hide()
            self.lbl_formatage.hide()
            self.decimales_tabval.hide()
        # Tableaux de signes
        elif self._param_.mode == 1:
            self.utiliser_cellspace.show()
            self.derivee.hide()
            self.limites.hide()
            self.formatage_images.hide()
            self.lbl_formatage.hide()
            self.decimales_tabvar_tabsign.show()
            self.decimales_tabval.hide()
            self.entree.setToolTip(tabsign.__doc__)
            if self._param_.utiliser_cellspace:
                self.code_entete.setText("\\usepackage{cellspace}")
            else:
                self.code_entete.setText("")
        # Tableaux de valeurs
        elif self._param_.mode == 2:
            self.utiliser_cellspace.hide()
            self.derivee.hide()
            self.limites.hide()
            self.decimales_tabvar_tabsign.hide()
            self.decimales_tabval.show()
            self.lbl_formatage.show()
            self.formatage_images.show()
            self.entree.setToolTip(tabval.__doc__)
            self.code_entete.setText("")
        self.valider()


    def valider(self):
        try:
            self.entree.valider()
        except Exception:
            print_error()
開發者ID:wxgeo,項目名稱:geophar,代碼行數:104,代碼來源:__init__.py


注:本文中的PyQt5.QtWidgets.QLineEdit.hide方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。