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


Python QLineEdit.show方法代碼示例

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


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

示例1: OffsetRow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [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

示例2: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
    def __init__(self, parent, bank_name, required_input):
        DialogContainer.__init__(self, parent)

        self.required_input = required_input

        uic.loadUi(get_ui_file_path('iom_input_dialog.ui'), self.dialog_widget)

        self.dialog_widget.cancel_button.clicked.connect(lambda: self.button_clicked.emit(0))
        self.dialog_widget.confirm_button.clicked.connect(lambda: self.button_clicked.emit(1))

        if 'error_text' in required_input:
            self.dialog_widget.error_text_label.setText(required_input['error_text'])
        else:
            self.dialog_widget.error_text_label.hide()

        if 'image' in required_input['additional_data']:
            qimg = QImage()
            qimg.loadFromData(b64decode(required_input['additional_data']['image']))
            image = QPixmap.fromImage(qimg)
            scene = QGraphicsScene(self.dialog_widget.img_graphics_view)
            scene.addPixmap(image)
            self.dialog_widget.img_graphics_view.setScene(scene)
        else:
            self.dialog_widget.img_graphics_view.hide()

        self.dialog_widget.iom_input_title_label.setText(bank_name)

        vlayout = QVBoxLayout()
        self.dialog_widget.user_input_container.setLayout(vlayout)

        self.input_widgets = {}

        for specific_input in self.required_input['required_fields']:
            label_widget = QLabel(self.dialog_widget.user_input_container)
            label_widget.setText(specific_input['text'] + ":")
            label_widget.show()
            vlayout.addWidget(label_widget)

            input_widget = QLineEdit(self.dialog_widget.user_input_container)
            input_widget.setPlaceholderText(specific_input['placeholder'])
            if specific_input['type'] == 'password':
                input_widget.setEchoMode(QLineEdit.Password)

            input_widget.show()
            vlayout.addWidget(input_widget)
            self.input_widgets[specific_input['name']] = input_widget

        self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        self.dialog_widget.adjustSize()

        self.on_main_window_resize()
開發者ID:Tribler,項目名稱:tribler,代碼行數:53,代碼來源:iom_input_dialog.py

示例3: MyPopup

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class MyPopup(QWidget):
    def __init__(self):
        global text_
        global fig, chartFig

        QWidget.__init__(self)
        self.setWindowTitle('Add new Speaker')
        self.main_widget = QtWidgets.QWidget(self)
        self.speakerID = QLineEdit(self)
        self.Ok = QPushButton("Ok", self)
        #self.show()

    # Draw new Speaker window
    #----------------------
    def paintEvent(self, e):
        self.speakerID.setPlaceholderText('Speaker...')
        self.speakerID.setMinimumWidth(100)
        self.speakerID.setEnabled(True)

        self.speakerID.move(90, 15)
        self.Ok.move(115, 60)

        self.speakerID.textChanged.connect(self.speakerLabel)
        self.Ok.clicked.connect(self.closeSpeaker)

        self.Ok.show()
        self.speakerID.show()

    def speakerLabel(self,text):
        global text_
        text_ = 'Speech::' + text 

    # Close and save new Speaker ID
    #----------------------
    def closeSpeaker(self):
        global text_
        global fig, chartFig
        if text_ != 'Add New Speaker':
            text_ = 'Speech::' + self.speakerID.text()
            self.Ok.clicked.disconnect() 
            self.close()

            fig.saveAnnotation()
            fig.draw()
            chartFig.axes.clear()
            chartFig.drawChart()
            chartFig.draw()
開發者ID:ElenaDiamantidou,項目名稱:audioGraph,代碼行數:49,代碼來源:gui.py

示例4: LatusFolderPage

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class LatusFolderPage(QWizardPage):
    def __init__(self):
        super().__init__()
        self.latus_folder_box = QLineEdit()
        self.latus_folder_box.setReadOnly(True)

        self.setTitle("Latus folder")
        self.setSubTitle("This is the Latus folder on your computer.  You may edit this path if you wish.")

        self.latus_folder_box.show()

        layout = QGridLayout()
        layout.addWidget(self.latus_folder_box, 0, 1)
        self.setLayout(layout)

        self.registerField(LATUS_FOLDER_FIELD_STRING, self.latus_folder_box)

    def initializePage(self):
        latus_folder = latus.wizard.latus_folder_from_cloud_folder(self.field(CLOUD_FOLDER_FIELD_STRING))
        self.latus_folder_box.setText(latus_folder)
開發者ID:jamesabel,項目名稱:latus,代碼行數:22,代碼來源:gui_wizard.py

示例5: LabelLineEdit

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [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: GalleryDialog

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

#.........這裏部分代碼省略.........
        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)
        self.lang_box.addItems(app_constants.G_CUSTOM_LANGUAGES)
        self.rating_box = add_check(QSpinBox())
        self.rating_box.setMaximum(5)
        self.rating_box.setMinimum(0)
        self._find_combobox_match(self.lang_box, app_constants.G_DEF_LANGUAGE, 0)
        tags_l = QVBoxLayout()
        tag_info = misc.ClickedLabel("How do i write namespace & tags? (hover)", parent=self)
        tag_info.setToolTip("Ways to write tags:\n\nNormal tags:\ntag1, tag2, tag3\n\n"+
                      "Namespaced tags:\nns1:tag1, ns1:tag2\n\nNamespaced tags with one or more"+
                      " tags under same namespace:\nns1:[tag1, tag2, tag3], ns2:[tag1, tag2]\n\n"+
                      "Those three ways of writing namespace & tags can be combined freely.\n"+
                      "Tags are seperated by a comma, NOT whitespace.\nNamespaces will be capitalized while tags"+
                      " will be lowercased.")
        tag_info.setToolTipDuration(99999999)
        tags_l.addWidget(tag_info)
        self.tags_edit = add_check(misc.CompleterTextEdit())
        self.tags_edit.setCompleter(misc.GCompleter(self, False, False))
        self.tags_append = QCheckBox("Append tags", self)
        self.tags_append.setChecked(False)
        if not self._multiple_galleries:
            self.tags_append.hide()
        if self._multiple_galleries:
            self.tags_append.setChecked(app_constants.APPEND_TAGS_GALLERIES)
            tags_ml = QVBoxLayout()
            tags_ml.addWidget(self.tags_append)
            tags_ml.addLayout(checkbox_layout(self.tags_edit), 5)
            tags_l.addLayout(tags_ml, 3)
        else:
            tags_l.addWidget(checkbox_layout(self.tags_edit), 5)
        self.tags_edit.setPlaceholderText("Press Tab to autocomplete (Ctrl + E to show popup)")
        self.type_box = add_check(QComboBox())
        self.type_box.addItems(app_constants.G_TYPES)
        self._find_combobox_match(self.type_box, app_constants.G_DEF_TYPE, 0)
        #self.type_box.currentIndexChanged[int].connect(self.doujin_show)
        #self.doujin_parent = QLineEdit()
        #self.doujin_parent.setVisible(False)
        self.status_box = add_check(QComboBox())
        self.status_box.addItems(app_constants.G_STATUS)
        self._find_combobox_match(self.status_box, app_constants.G_DEF_STATUS, 0)
        self.pub_edit = add_check(QDateEdit())
        self.pub_edit.setCalendarPopup(True)
        self.pub_edit.setDate(QDate.currentDate())
        self.path_lbl = misc.ClickedLabel("")
        self.path_lbl.setWordWrap(True)
        self.path_lbl.clicked.connect(lambda a: utils.open_path(a, a) if a else None)

        link_layout = QHBoxLayout()
        self.link_lbl = add_check(QLabel(""))
        self.link_lbl.setWordWrap(True)
        self.link_edit = QLineEdit()
        link_layout.addWidget(self.link_edit)
        if self._multiple_galleries:
            link_layout.addLayout(checkbox_layout(self.link_lbl))
        else:
            link_layout.addWidget(checkbox_layout(self.link_lbl))
        self.link_edit.hide()
        self.link_btn = QPushButton("Modify")
        self.link_btn.setFixedWidth(50)
        self.link_btn2 = QPushButton("Set")
        self.link_btn2.setFixedWidth(40)
        self.link_btn.clicked.connect(self.link_modify)
        self.link_btn2.clicked.connect(self.link_set)
開發者ID:Pewpews,項目名稱:happypanda,代碼行數:70,代碼來源:gallerydialog.py

示例7: CreerSuite

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [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

示例8: ApolMainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class ApolMainWindow(SEToolsWidget, QMainWindow):

    def __init__(self, filename):
        super(ApolMainWindow, self).__init__()
        self.log = logging.getLogger(__name__)
        self._permmap = None
        self._policy = None
        self.setupUi()

        self.load_permmap()

        if filename:
            self.load_policy(filename)

        if self._policy:
            self.create_new_analysis("Summary", SummaryTab)

        self.update_window_title()
        self.toggle_workspace_actions()

    def setupUi(self):
        self.load_ui("apol/apol.ui")

        self.tab_counter = 0

        # set up analysis menu
        self.chooser = ChooseAnalysis(self)

        # set up error message dialog
        self.error_msg = QMessageBox(self)
        self.error_msg.setStandardButtons(QMessageBox.Ok)

        # set up permission map editor
        self.permmap_editor = PermissionMapEditor(self, True)

        # set up tab name editor
        self.tab_editor = QLineEdit(self.AnalysisTabs)
        self.tab_editor.setWindowFlags(Qt.Popup)

        # configure tab bar context menu
        tabBar = self.AnalysisTabs.tabBar()
        tabBar.addAction(self.rename_tab_action)
        tabBar.addAction(self.close_tab_action)
        tabBar.setContextMenuPolicy(Qt.ActionsContextMenu)

        # capture INFO and higher Python messages from setools lib for status bar
        handler = LogHandlerToSignal()
        handler.message.connect(self.statusbar.showMessage)
        logging.getLogger("setools").addHandler(handler)
        logging.getLogger("setoolsgui").addHandler(handler)

        # set up help browser process
        self.help_process = QProcess()

        # connect signals
        self.open_policy.triggered.connect(self.select_policy)
        self.close_policy_action.triggered.connect(self.close_policy)
        self.open_permmap.triggered.connect(self.select_permmap)
        self.new_analysis.triggered.connect(self.choose_analysis)
        self.AnalysisTabs.currentChanged.connect(self.toggle_workspace_actions)
        self.AnalysisTabs.tabCloseRequested.connect(self.close_tab)
        self.AnalysisTabs.tabBarDoubleClicked.connect(self.tab_name_editor)
        self.tab_editor.editingFinished.connect(self.rename_tab)
        self.rename_tab_action.triggered.connect(self.rename_active_tab)
        self.close_tab_action.triggered.connect(self.close_active_tab)
        self.new_from_settings_action.triggered.connect(self.new_analysis_from_config)
        self.load_settings_action.triggered.connect(self.load_settings)
        self.save_settings_action.triggered.connect(self.save_settings)
        self.load_workspace_action.triggered.connect(self.load_workspace)
        self.save_workspace_action.triggered.connect(self.save_workspace)
        self.copy_action.triggered.connect(self.copy)
        self.cut_action.triggered.connect(self.cut)
        self.paste_action.triggered.connect(self.paste)
        self.edit_permmap_action.triggered.connect(self.edit_permmap)
        self.save_permmap_action.triggered.connect(self.save_permmap)
        self.about_apol_action.triggered.connect(self.about_apol)
        self.apol_help_action.triggered.connect(self.apol_help)

        self.show()

    def update_window_title(self):
        if self._policy:
            self.setWindowTitle("{0} - apol".format(self._policy))
        else:
            self.setWindowTitle("apol")

    #
    # Policy handling
    #
    def select_policy(self):
        old_policy = self._policy

        if old_policy and self.AnalysisTabs.count() > 0:
            reply = QMessageBox.question(
                self, "Continue?",
                "Loading a policy will close all existing analyses.  Continue?",
                QMessageBox.Yes | QMessageBox.No)

            if reply == QMessageBox.No:
                return
#.........這裏部分代碼省略.........
開發者ID:TresysTechnology,項目名稱:setools,代碼行數:103,代碼來源:mainwindow.py

示例9: TabLaTeX

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [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

示例10: Window

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.lineinp = QLineEdit(self)
        self.lineinp.setPlaceholderText("Enter the site's URL here")

        self.boxinp = QComboBox(self)
        self.boxinp.addItems(['LiveLib', 'ReadRate',
                              'Libs', 'Readly'])

        self.prsbtn = QPushButton('Parse!', self)
        self.prsbtn.clicked.connect(self.prsbuttonClicked)

        self.wtfbtn = QPushButton('WTF', self)
        self.wtfbtn.clicked.connect(self.wtfbuttonClicked)

        self.datalist = QListWidget(self)

        self.msgbox = QMessageBox()
        self.msgbtn = QPushButton('Попробовать снова')
        self.msgbox.addButton(self.msgbtn, QMessageBox.DestructiveRole)
        self.msgbox.setWindowTitle('Ой, что-то не так')
        self.msgbox.setWindowIcon(QIcon('sad.png'))
        self.center(self.msgbox)

        grid = QGridLayout()
        grid.addWidget(self.lineinp, 1, 0, 1, 2)
        grid.addWidget(self.boxinp, 2, 0, 1, 2)
        grid.addWidget(self.prsbtn, 3, 0)
        grid.addWidget(self.wtfbtn, 3, 1)
        grid.addWidget(self.datalist, 4, 0, 4, 2)

        self.setLayout(grid)

        self.boxinp.hide()

        self.resize(600, 600)
        self.center(self)
        self.setWindowTitle('My big fully-functional parser')
        self.setWindowIcon(QIcon('www.png'))
        self.show()

    def center(self, obj):
        qr = obj.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def wtfbuttonClicked(self):
        if self.boxinp.isVisible():
            self.boxinp.hide()
            self.lineinp.show()
        else:
            self.boxinp.show()
            self.lineinp.hide()

    def prsbuttonClicked(self):
        self.datalist.clear()
        if self.lineinp.isVisible():
            self.setTopByLine()
        else:
            self.setTopByBox()

    def connection_try(self, currentsite):
        try:
            data = currentsite.get_books_list()
        except requests.exceptions.ConnectionError:
            self.msgbox.setText('Ошибка сети')
            self.msgbox.setInformativeText('Проверьте подключение к интернету')
            self.msgbox.show()
        else:
            self.datalist.addItems(data)

    def setTopByBox(self):
        sitename = self.boxinp.currentText()
        currentsite = backend.sites[sitename]
        self.connection_try(currentsite)

    # На самом деле очевидно, что данный парсер с его архитектурой
    # весьма глупо реализовывать через ввод URL
    # данная возможность предусмотренна исключетельно ради примера использования QLineEdit

    def setTopByLine(self):
        siteurl = self.lineinp.text()
        if siteurl in backend.urls:
            currentsite = backend.urls[siteurl]
            self.connection_try(currentsite)
        else:
            self.msgbox.setText('Что такое?')
            self.msgbox.setInformativeText('Введите нормальный URL')
            self.msgbtn.clicked.connect(lambda: self.prsbtn.setText('Исправил, проверяйте'))
            self.msgbox.show()
開發者ID:lambdafrela,項目名稱:parser,代碼行數:97,代碼來源:interface.py

示例11: ApolMainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class ApolMainWindow(SEToolsWidget, QMainWindow):

    def __init__(self, filename):
        super(ApolMainWindow, self).__init__()
        self.log = logging.getLogger(__name__)
        self._permmap = None
        self._policy = None
        self.setupUi()

        self.load_permmap()

        if filename:
            self.load_policy(filename)

        if self._policy:
            self.create_new_analysis("Summary", SummaryTab)

        self.update_window_title()

    def setupUi(self):
        self.load_ui("apol.ui")

        self.tab_counter = 0

        # set up analysis menu
        self.chooser = ChooseAnalysis(self)

        # set up error message dialog
        self.error_msg = QMessageBox(self)
        self.error_msg.setStandardButtons(QMessageBox.Ok)

        # set up permission map editor
        self.permmap_editor = PermissionMapEditor(self, True)

        # set up tab name editor
        self.tab_editor = QLineEdit(self.AnalysisTabs)
        self.tab_editor.setWindowFlags(Qt.Popup)

        # configure tab bar context menu
        tabBar = self.AnalysisTabs.tabBar()
        tabBar.addAction(self.rename_tab_action)
        tabBar.addAction(self.close_tab_action)
        tabBar.setContextMenuPolicy(Qt.ActionsContextMenu)

        # capture INFO and higher Python messages from setools lib for status bar
        handler = LogHandlerToSignal()
        handler.message.connect(self.statusbar.showMessage)
        logging.getLogger("setools").addHandler(handler)
        logging.getLogger("setoolsgui").addHandler(handler)

        # set up help browser process
        self.help_process = QProcess()

        # connect signals
        self.open_policy.triggered.connect(self.select_policy)
        self.close_policy_action.triggered.connect(self.close_policy)
        self.open_permmap.triggered.connect(self.select_permmap)
        self.new_analysis.triggered.connect(self.choose_analysis)
        self.AnalysisTabs.tabCloseRequested.connect(self.close_tab)
        self.AnalysisTabs.tabBarDoubleClicked.connect(self.tab_name_editor)
        self.tab_editor.editingFinished.connect(self.rename_tab)
        self.rename_tab_action.triggered.connect(self.rename_active_tab)
        self.close_tab_action.triggered.connect(self.close_active_tab)
        self.copy_action.triggered.connect(self.copy)
        self.cut_action.triggered.connect(self.cut)
        self.paste_action.triggered.connect(self.paste)
        self.edit_permmap_action.triggered.connect(self.edit_permmap)
        self.save_permmap_action.triggered.connect(self.save_permmap)
        self.about_apol_action.triggered.connect(self.about_apol)
        self.apol_help_action.triggered.connect(self.apol_help)

        self.show()

    def update_window_title(self):
        if self._policy:
            self.setWindowTitle("{0} - apol".format(self._policy))
        else:
            self.setWindowTitle("apol")

    #
    # Policy handling
    #
    def select_policy(self):
        old_policy = self._policy

        if old_policy and self.AnalysisTabs.count() > 0:
            reply = QMessageBox.question(
                self, "Continue?",
                "Loading a policy will close all existing analyses.  Continue?",
                QMessageBox.Yes | QMessageBox.No)

            if reply == QMessageBox.No:
                return

        filename = QFileDialog.getOpenFileName(self, "Open policy file", ".",
                                               "SELinux Policies (policy.* sepolicy);;"
                                               "All Files (*)")[0]
        if filename:
            self.load_policy(filename)

#.........這裏部分代碼省略.........
開發者ID:jakev,項目名稱:setools,代碼行數:103,代碼來源:mainwindow.py

示例12: plot_dlg_class

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

    def populate_combo_box_using_input_file(self,combobox,input_file):
#		try:
        lines=[]
        inp_load_file(lines,os.path.join(self.path,input_file))
        combobox.clear()

        for i in range(0, len(lines)):
            lines[i]=lines[i].rstrip()
            if len(lines[i])>0:
                if lines[i][0]=="#":
                    combobox.addItem(lines[i])
#		except:
#
#			combobox.clear()

    def callback_edit0(self):
        self.populate_combo_box_using_input_file(self.token0,self.file0.text())

    def callback_edit1(self):
        self.populate_combo_box_using_input_file(self.token1,self.file1.text())

    def callback_edit2(self):
        self.populate_combo_box_using_input_file(self.token2,self.file2.text())

    def callback_click_ok(self,data):
        data.file0=self.file0.text()
        data.tag0=str(self.token0.currentText())
        data.file1=self.file1.text()
        data.tag1=str(self.token1.currentText())
        data.file2=self.file2.text()
        data.tag2=str(self.token2.currentText())
        self.ret=True
        self.close()

    def callback_click_cancel(self):
        self.ret=False
        self.close()

    def __init__(self,data):
        QWidget.__init__(self)
        self.path=os.path.dirname(data.example_file0)
        self.setWindowIcon(QIcon(os.path.join(get_image_file_path(),"jv.png")))
        self.setWindowTitle(_("Steady state simulation (www.gpvdm.com)")) 
        self.setWindowFlags(Qt.WindowStaysOnTopHint)

        l=QLabel("x-axis:")
        vbox=QVBoxLayout()
        hbox=QHBoxLayout()
        self.file0 = QLineEdit()
        self.file0.setText(data.file0)
        self.file0.textChanged.connect(self.callback_edit0)
        hbox.addWidget(self.file0)


        self.token0 = QComboBox()
        self.populate_combo_box_using_input_file(self.token0, os.path.basename(data.example_file0))
        hbox.addWidget(self.token0)

        vbox.addWidget(l)
        hbox_widget=QWidget()
        hbox_widget.setLayout(hbox)
        vbox.addWidget(hbox_widget)

        #y-axis
        l=QLabel("y-axis:")
        l.show()

        hbox=QHBoxLayout()
        self.file1 = QLineEdit()
        self.file1.setText(data.file0)
        self.file1.textChanged.connect(self.callback_edit1)
        self.file1.show()
        hbox.addWidget(self.file1)

        self.token1 = QComboBox()
        self.populate_combo_box_using_input_file(self.token1,os.path.basename(data.example_file1))
        hbox.addWidget(self.token1)

        vbox.addWidget(l)
        hbox_widget=QWidget()
        hbox_widget.setLayout(hbox)
        vbox.addWidget(hbox_widget)

        #label
        l=QLabel("label:")

        hbox=QHBoxLayout()
        self.file2 = QLineEdit( )
        self.file2.setText(data.file0)
        self.file2.textChanged.connect(self.callback_edit2)
        hbox.addWidget(self.file2)

        self.token2 = QComboBox()
        self.populate_combo_box_using_input_file(self.token2,os.path.basename(data.example_file1))
        hbox.addWidget(self.token2)

        vbox.addWidget(l)
        hbox_widget=QWidget()
#.........這裏部分代碼省略.........
開發者ID:roderickmackenzie,項目名稱:gpvdm,代碼行數:103,代碼來源:plot_dlg.py

示例13: ApolMainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class ApolMainWindow(SEToolsWidget, QMainWindow):

    def __init__(self, filename):
        super(ApolMainWindow, self).__init__()
        self.log = logging.getLogger(__name__)

        if filename:
            self._policy = SELinuxPolicy(filename)
        else:
            self._policy = None

        try:
            # try to load default permission map
            self._permmap = PermissionMap()
        except (IOError, OSError) as ex:
            self.log.info("Failed to load default permission map: {0}".format(ex))
            self._permmap = None

        self.setupUi()

    def setupUi(self):
        self.load_ui("apol.ui")

        self.tab_counter = 0

        self.update_window_title()

        # set up error message dialog
        self.error_msg = QMessageBox(self)
        self.error_msg.setStandardButtons(QMessageBox.Ok)

        # set up tab name editor
        self.tab_editor = QLineEdit(self.AnalysisTabs)
        self.tab_editor.setWindowFlags(Qt.Popup)

        # configure tab bar context menu
        tabBar = self.AnalysisTabs.tabBar()
        tabBar.addAction(self.rename_tab_action)
        tabBar.addAction(self.close_tab_action)
        tabBar.setContextMenuPolicy(Qt.ActionsContextMenu)

        # capture INFO and higher Python messages from setools lib for status bar
        handler = LogHandlerToSignal()
        handler.message.connect(self.statusbar.showMessage)
        logging.getLogger("setools").addHandler(handler)
        logging.getLogger("setoolsgui").addHandler(handler)

        # connect signals
        self.open_policy.triggered.connect(self.select_policy)
        self.open_permmap.triggered.connect(self.select_permmap)
        self.new_analysis.triggered.connect(self.choose_analysis)
        self.AnalysisTabs.tabCloseRequested.connect(self.close_tab)
        self.AnalysisTabs.tabBarDoubleClicked.connect(self.tab_name_editor)
        self.tab_editor.editingFinished.connect(self.rename_tab)
        self.rename_tab_action.triggered.connect(self.rename_active_tab)
        self.close_tab_action.triggered.connect(self.close_active_tab)
        self.copy_action.triggered.connect(self.copy)
        self.cut_action.triggered.connect(self.cut)
        self.paste_action.triggered.connect(self.paste)

        self.show()

    def update_window_title(self):
        if self._policy:
            self.setWindowTitle("{0} - apol".format(self._policy))
        else:
            self.setWindowTitle("apol")

    def select_policy(self):
        filename = QFileDialog.getOpenFileName(self, "Open policy file", ".")[0]
        if filename:
            try:
                self._policy = SELinuxPolicy(filename)
            except Exception as ex:
                self.error_msg.critical(self, "Policy loading error", str(ex))
            else:
                self.update_window_title()

                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()

#.........這裏部分代碼省略.........
開發者ID:stevedlawrence,項目名稱:setools,代碼行數:103,代碼來源:mainwindow.py

示例14: InstallWizard

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import show [as 別名]
class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):

    accept_signal = pyqtSignal()

    def __init__(self, config, app, plugins):
        QDialog.__init__(self, None)
        BaseWizard.__init__(self, config, plugins)
        self.setWindowTitle('Vialectrum  -  ' + _('Install Wizard'))
        self.app = app
        self.config = config
        # Set for base base class
        self.language_for_seed = config.get('language')
        self.setMinimumSize(600, 400)
        self.accept_signal.connect(self.accept)
        self.title = QLabel()
        self.main_widget = QWidget()
        self.back_button = QPushButton(_("Back"), self)
        self.back_button.setText(_('Back') if self.can_go_back() else _('Cancel'))
        self.next_button = QPushButton(_("Next"), self)
        self.next_button.setDefault(True)
        self.logo = QLabel()
        self.please_wait = QLabel(_("Please wait..."))
        self.please_wait.setAlignment(Qt.AlignCenter)
        self.icon_filename = None
        self.loop = QEventLoop()
        self.rejected.connect(lambda: self.loop.exit(0))
        self.back_button.clicked.connect(lambda: self.loop.exit(1))
        self.next_button.clicked.connect(lambda: self.loop.exit(2))
        outer_vbox = QVBoxLayout(self)
        inner_vbox = QVBoxLayout()
        inner_vbox.addWidget(self.title)
        inner_vbox.addWidget(self.main_widget)
        inner_vbox.addStretch(1)
        inner_vbox.addWidget(self.please_wait)
        inner_vbox.addStretch(1)
        scroll_widget = QWidget()
        scroll_widget.setLayout(inner_vbox)
        scroll = QScrollArea()
        scroll.setWidget(scroll_widget)
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setWidgetResizable(True)
        icon_vbox = QVBoxLayout()
        icon_vbox.addWidget(self.logo)
        icon_vbox.addStretch(1)
        hbox = QHBoxLayout()
        hbox.addLayout(icon_vbox)
        hbox.addSpacing(5)
        hbox.addWidget(scroll)
        hbox.setStretchFactor(scroll, 1)
        outer_vbox.addLayout(hbox)
        outer_vbox.addLayout(Buttons(self.back_button, self.next_button))
        self.set_icon('vialectrum.png')
        self.show()
        self.raise_()
        self.refresh_gui()  # Need for QT on MacOSX.  Lame.

    def select_storage(self, path, get_wallet_from_daemon) -> Tuple[str, Optional[WalletStorage]]:

        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(_('Wallet') + ':'))
        self.name_e = QLineEdit()
        hbox.addWidget(self.name_e)
        button = QPushButton(_('Choose...'))
        hbox.addWidget(button)
        vbox.addLayout(hbox)

        self.msg_label = QLabel('')
        vbox.addWidget(self.msg_label)
        hbox2 = QHBoxLayout()
        self.pw_e = QLineEdit('', self)
        self.pw_e.setFixedWidth(150)
        self.pw_e.setEchoMode(2)
        self.pw_label = QLabel(_('Password') + ':')
        hbox2.addWidget(self.pw_label)
        hbox2.addWidget(self.pw_e)
        hbox2.addStretch()
        vbox.addLayout(hbox2)
        self.set_layout(vbox, title=_('Vialectrum wallet'))

        self.temp_storage = WalletStorage(path, manual_upgrades=True)
        wallet_folder = os.path.dirname(self.temp_storage.path)

        def on_choose():
            path, __ = QFileDialog.getOpenFileName(self, "Select your wallet file", wallet_folder)
            if path:
                self.name_e.setText(path)

        def on_filename(filename):
            path = os.path.join(wallet_folder, filename)
            wallet_from_memory = get_wallet_from_daemon(path)
            try:
                if wallet_from_memory:
                    self.temp_storage = wallet_from_memory.storage
                else:
                    self.temp_storage = WalletStorage(path, manual_upgrades=True)
                self.next_button.setEnabled(True)
            except BaseException:
                self.logger.exception('')
                self.temp_storage = None
#.........這裏部分代碼省略.........
開發者ID:vialectrum,項目名稱:vialectrum,代碼行數:103,代碼來源:installwizard.py

示例15: Planet_BuildItemWidget

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

#.........這裏部分代碼省略.........
        else:
            self._lbl_pix.setPixmap(self._pix.scaled(80, 80))
            # self._lbl_pix.setPixmap(self._pix)
        # name, level
        self._lbl_name.setText(bitem.name)
        if self._bitem.is_shipyard_item:
            # shipyard items use quantity instead of level
            self._lbl_lvl.setText(str(bitem.quantity))
        else:
            self._lbl_lvl.setText(str(bitem.level))
        # time
        if bitem.seconds_total != -1:
            self._lbl_timestr.setText(time_seconds_to_str(bitem.seconds_total))
        else:
            self._lbl_timestr.setText('-')
        # colors
        color_enough = '#008800'
        color_notenough = '#AA0000'
        enough_met = True
        enough_cry = True
        enough_deit = True
        enough_energy = True
        # price met
        if bitem.cost_met > 0:
            setstr = number_format(bitem.cost_met)
            color = color_enough
            if res_cur.met < bitem.cost_met:
                setstr += ' (-{0})'.format(number_format(
                        int(bitem.cost_met - res_cur.met)))
                color = color_notenough
                enough_met = False
            self._lbl_price_met.setText('<font color="{0}">{1}</font>'.format(
                    color, setstr))
            self._lbl_price_met_ico.show()
            self._lbl_price_met.show()
        else:
            self._lbl_price_met_ico.hide()
            self._lbl_price_met.hide()
        # price cry
        if bitem.cost_cry > 0:
            setstr = number_format(bitem.cost_cry)
            color = color_enough
            if res_cur.cry < bitem.cost_cry:
                setstr += ' (-{0})'.format(number_format(
                        int(bitem.cost_cry - res_cur.cry)))
                color = color_notenough
                enough_cry = False
            self._lbl_price_cry.setText('<font color="{0}">{1}</font>'.format(
                    color, setstr))
            self._lbl_price_cry_ico.show()
            self._lbl_price_cry.show()
        else:
            self._lbl_price_cry_ico.hide()
            self._lbl_price_cry.hide()
        # price deit
        if bitem.cost_deit > 0:
            setstr = number_format(bitem.cost_deit)
            color = color_enough
            if res_cur.deit < bitem.cost_deit:
                setstr += ' (-{0})'.format(number_format(
                        int(bitem.cost_deit - res_cur.deit)))
                color = color_notenough
                enough_deit = False
            self._lbl_price_deit.setText('<font color="{0}">{1}</font>'.format(
                    color, setstr))
            self._lbl_price_deit_ico.show()
開發者ID:minlexx,項目名稱:xnovacmd,代碼行數:70,代碼來源:planet_widget.py


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