Python PyQt5.QtWidgets.QLineEdit() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QLineEdit(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: Micchinetta   Author: SqrtPapere   File: DatabaseManager.py    MIT License 6 votes vote down vote up
def __init__(self, d):
        """Class constructor that sets up the window layout and allocates attributes"""
        super().__init__()
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                      | QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        self.vLayout = QVBoxLayout()

        self.le_dict = {}

        for key in d:
            h = QHBoxLayout()
            h.addWidget(QLabel(key))
            qe = QLineEdit()
            self.le_dict[key] = qe
            h.addWidget(qe)
            self.vLayout.addLayout(h)

        self.vLayout.addWidget(self.buttonBox)

        self.setLayout(self.vLayout) 
Example 2
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, setting_params=None):
        super().__init__()
        self.setting_params = setting_params
        self.search_input = Qw.QLineEdit()
        self.table = AngryTableView(self.setting_params['angrysearch_lite'],
                                    self.setting_params['row_height'])
        self.upd_button = Qw.QPushButton('update')
        self.fts_checkbox = Qw.QCheckBox()

        grid = Qw.QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.search_input, 1, 1)
        grid.addWidget(self.fts_checkbox, 1, 3)
        grid.addWidget(self.upd_button, 1, 4)
        grid.addWidget(self.table, 2, 1, 4, 4)
        self.setLayout(grid)

        self.setTabOrder(self.search_input, self.table)
        self.setTabOrder(self.table, self.upd_button)


# THE MAIN APPLICATION WINDOW WITH THE STATUS BAR AND LOGIC
# LOADS AND SAVES QSETTINGS FROM ~/.config/angrysearch
# INITIALIZES AND SETS GUI, WAITING FOR USER INPUTS 
Example 3
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    GNU General Public License v2.0 6 votes vote down vote up
def exclude_dialog(self):
        text, ok = Qw.QInputDialog.getText(
            self, '~/.config/angrysearch/', 'Directories to be ignored:',
            Qw.QLineEdit.Normal, self.exclud_dirs)
        if ok:
            text = text.strip()
            self.exclud_dirs = text
            self.settings.setValue('directories_excluded', text)
            self.parent().setting_params['directories_excluded'] = text.strip().split()
            if text == '':
                self.excluded_dirs_btn.setText('none')
                self.excluded_dirs_btn.setStyleSheet('color:#888;'
                                                     'font:italic;')
            else:
                self.excluded_dirs_btn.setText(text)
                self.excluded_dirs_btn.setStyleSheet('')
            self.OK_button.setFocus() 
Example 4
Project: ILTIS   Author: grg2rsr   File: Options_Control_Widget.py    GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, dict_name, param_name, label='select path', FileDialogOptions=None):
        super(PathSelectWidget,self).__init__(parent=parent)
        self.dict_name = dict_name
        self.param_name = param_name

        self.parent = parent
        self.FileDialogOptions = FileDialogOptions

        self.Button = QtWidgets.QPushButton(self,label)
        self.PathDisplay = QtWidgets.QLineEdit(self)

        layout = QtWidgets.QHBoxLayout(self)
        layout.addWidget(self.Button)
        layout.addWidget(self.PathDisplay)

        self.path = None 
Example 5
Project: idasec   Author: RobinDavid   File: custom_widgets.py    GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self, items, parent=None):
        super(ButtonLineEdit, self).__init__(parent)

        self.menu = QtWidgets.QMenu()
        for i in items:
          self.menu.addAction(i)

        self.button = QtWidgets.QToolButton(self)
        self.button.setStyleSheet('border: 0px; padding: 0px;')
        self.button.setCursor(QtCore.Qt.ArrowCursor)
        self.button.triggered.connect(self.menu_action_triggered)
        self.button.setPopupMode(QtWidgets.QToolButton.InstantPopup)
        self.button.setMenu(self.menu)

        frameWidth = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth)
        buttonSize = self.button.sizeHint()

        self.setAlignment(QtCore.Qt.Alignment(QtCore.Qt.AlignHCenter))
        self.setStyleSheet('QLineEdit {padding-right: %dpx; }' % (buttonSize.width() + frameWidth + 1))
        self.setMinimumSize(max(self.minimumSizeHint().width(), buttonSize.width() + frameWidth*2 + 2),
                            max(self.minimumSizeHint().height(), buttonSize.height() + frameWidth*2 + 2))
        self.setMaximumWidth(100) 
Example 6
Project: dcc   Author: amimo   File: stringswindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, session=None):
        super(StringsWindow, self).__init__(parent)
        self.mainwin = win
        self.session = session
        self.title = "Strings"

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter string pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.stringswindow = StringsValueWindow(self, win, session)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.stringswindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 7
Project: dcc   Author: amimo   File: renamewindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, element="", info=()):
        super(RenameDialog, self).__init__(parent)

        self.sourceWin = parent
        self.info = info
        self.element = element
        title = "Rename: " + element
        self.setWindowTitle(title)

        layout = QtWidgets.QGridLayout()
        question = QtWidgets.QLabel("Please enter new name:")
        layout.addWidget(question, 0, 0)
        self.lineEdit = QtWidgets.QLineEdit()
        layout.addWidget(self.lineEdit, 0, 1)
        self.buttonOK = QtWidgets.QPushButton("OK", self)
        layout.addWidget(self.buttonOK, 1, 1)
        self.buttonCancel = QtWidgets.QPushButton("Cancel", self)
        layout.addWidget(self.buttonCancel, 1, 0)

        self.lineEdit.setText(self.element)

        self.setLayout(layout)

        self.buttonCancel.clicked.connect(self.cancelClicked)
        self.buttonOK.clicked.connect(self.okClicked) 
Example 8
Project: dcc   Author: amimo   File: resourceswindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, session=None):
        super(ResourcesWindow, self).__init__(parent)
        self.mainwin = win
        self.session = session
        self.title = "Resources"

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter resource integer pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.resourceswindow = ResourcesValueWindow(self, win, session)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.resourceswindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 9
Project: dcc   Author: amimo   File: methodswindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, session=None):
        super(MethodsWindow, self).__init__(parent)
        self.mainwin = win
        self.session = session
        self.title = "Methods"

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter method name pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.methodswindow = MethodsValueWindow(self, win, session)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.methodswindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 10
Project: Python_Master_Courses   Author: makelove   File: input_button_clear.py    GNU General Public License v3.0 6 votes vote down vote up
def initUI(self):
        self.inputLabel = QLabel("Input your text")
        self.editLine = QLineEdit()
        self.printButton = QPushButton("Print")
        self.clearButton = QPushButton("Clear")

        self.printButton.clicked.connect(self.printText)
        self.clearButton.clicked.connect(self.clearText)

        inputLayout = QHBoxLayout()
        inputLayout.addWidget(self.inputLabel)
        inputLayout.addWidget(self.editLine)

        buttonLayout = QHBoxLayout()
        buttonLayout.addWidget(self.printButton)
        buttonLayout.addWidget(self.clearButton)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(inputLayout)
        mainLayout.addLayout(buttonLayout)

        self.setLayout(mainLayout)
        self.setWindowTitle('FristWindow')
        self.show() 
Example 11
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 6 votes vote down vote up
def init_widgets(self):
        self.setWindowTitle(self.tr("Search Movies"))
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.movie_name_label = QLabel(self.tr("电影名称:"))
        self.movie_name_line_edit = QLineEdit()

        self.movie_source_label = QLabel(self.tr("选择片源:"))
        self.movie_source_combobox = QComboBox()
        self.movie_source_combobox.addItem(self.tr('电影天堂'))

        self.search_push_button = QPushButton(self.tr("查询"))

        self.tip_label = QLabel(self.tr("未开始查询..."))
        self.search_content_label = QLabel(self.tr("查询内容:"))
        self.search_content_text_list = QListWidget()

        self.menu_bar = self.menuBar()

        return self 
Example 12
Project: LeitnerEmulator   Author: lovac42   File: plan0.py    GNU General Public License v3.0 6 votes vote down vote up
def dconfsetupUi(self, Dialog):
    r=self.gridLayout_3.rowCount()

    self.sm0emu = QtWidgets.QCheckBox(self.tab_3)
    self.sm0emu.setObjectName(_fromUtf8("sm0emu"))
    self.sm0emu.setText(_('Use Custom Intervals'))
    self.gridLayout_3.addWidget(self.sm0emu, r, 0, 1, 3)
    self.sm0emu.toggled.connect(lambda:togglesm0emuCB(self))
    r+=1

    self.sm2HLayout = QtWidgets.QHBoxLayout()
    self.sm2HLayout.setObjectName(_fromUtf8("sm2HLayout"))
    self.sm0StepsLabel = QtWidgets.QLabel(Dialog)
    self.sm0StepsLabel.setObjectName(_fromUtf8("sm0StepsLabel"))
    self.sm0StepsLabel.setText(_("Ivl Steps:"))
    self.sm2HLayout.addWidget(self.sm0StepsLabel)

    self.sm0Steps = QtWidgets.QLineEdit(self.tab_3)
    self.sm0Steps.setObjectName(_fromUtf8("sm0Steps"))
    self.sm2HLayout.addWidget(self.sm0Steps)
    self.gridLayout_3.addLayout(self.sm2HLayout, r, 0, 1, 2) 
Example 13
Project: Python-GUI   Author: arpitj07   File: scorewidnow.py    MIT License 6 votes vote down vote up
def setupUi(self, ScoreWindow):
        ScoreWindow.setObjectName("ScoreWindow")
        ScoreWindow.resize(471, 386)
        self.centralwidget = QtWidgets.QWidget(ScoreWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.Score = QtWidgets.QLineEdit(self.centralwidget)
        self.Score.setGeometry(QtCore.QRect(180, 180, 113, 22))
        self.Score.setObjectName("Score")
        self.teamscore = QtWidgets.QLabel(self.centralwidget)
        self.teamscore.setGeometry(QtCore.QRect(180, 130, 151, 20))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.teamscore.setFont(font)
        self.teamscore.setObjectName("teamscore")
        ScoreWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(ScoreWindow)
        self.statusbar.setObjectName("statusbar")
        ScoreWindow.setStatusBar(self.statusbar)

        self.retranslateUi(ScoreWindow)
        QtCore.QMetaObject.connectSlotsByName(ScoreWindow) 
Example 14
Project: cct   Author: awacha   File: settingspage.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def fromConfig(self, config:Config):
        for widget, configname in self._trackedWidgets:
            if isinstance(widget, QtWidgets.QComboBox):
                idx = widget.findText(getattr(config, configname))
                if idx<0:
                    raise ValueError('Cannot find config value {} for item {} in the list for the combo box.'.format(getattr(config, configname), configname))
                widget.setCurrentIndex(idx)
            elif isinstance(widget, QtWidgets.QSpinBox) or isinstance(widget, QtWidgets.QDoubleSpinBox):
                widget.setValue(getattr(config, configname))
            elif isinstance(widget, QtWidgets.QCheckBox):
                widget.setChecked(getattr(config, configname))
            elif isinstance(widget, QtWidgets.QLineEdit):
                widget.setText(getattr(config, configname))
            else:
                raise ValueError(
                    'Unknown widget type {} associated with config item {}'.format(type(widget), configname))
        self.resetChangedWidgets() 
Example 15
Project: cct   Author: awacha   File: settingspage.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def toConfig(self, config:Config, onlychanged:bool=True):
        for widget, configname in self._trackedWidgets:
            if onlychanged and (widget not in self._changedWidgets):
                continue
            if isinstance(widget, QtWidgets.QComboBox):
                setattr(config, configname, widget.currentText())
            elif isinstance(widget, QtWidgets.QSpinBox) or isinstance(widget, QtWidgets.QDoubleSpinBox):
                setattr(config, configname, widget.value())
            elif isinstance(widget, QtWidgets.QCheckBox):
                setattr(config, configname, widget.isChecked())
            elif isinstance(widget, QtWidgets.QLineEdit):
                setattr(config, configname, widget.text())
            else:
                raise ValueError(
                    'Unknown widget type {} associated with config item {}'.format(type(widget), configname))
            self._changedWidgets = [w for w in self._changedWidgets if w is not widget] # remove _all_ occurrences
        self.changed.emit(bool(self._changedWidgets)) 
Example 16
Project: MeiTingTrunk   Author: Xunius   File: meta_tab.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self,lib_folder,parent=None):
        '''
        Args:
            parent (QWidget): parent widget.
            lib_folder (str): abspath to lib_current_folder.

        This modified QLineEdit accepts a file path as its text, and displays
        an elided version of the file name part of the path.
        '''

        super(FileLineEdit,self).__init__(parent)
        self.fm=QFontMetrics(self.font())
        self.lib_folder=lib_folder
        self.parent=parent

        self.type_label=QtWidgets.QLabel()
        self.file_type_icon=QIcon.fromTheme('emblem-documents',
            self.style().standardIcon(QStyle.SP_FileIcon)).pixmap(
                    QSize(16,16))
        self.link_type_icon=QIcon.fromTheme('emblem-symbolic-link',
            self.style().standardIcon(QStyle.SP_FileLinkIcon)).pixmap(
                    QSize(16,16))

        self.editingFinished.connect(self.checkNewValue) # focus out or return 
Example 17
Project: Lector   Author: BasioMeusPuga   File: dockwidgets.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        self.parent = parent
        self.parentTab = self.parent.parent

        self.searchThread = BackGroundTextSearch()
        self.searchOptionsLayout = QtWidgets.QHBoxLayout()
        self.searchTabLayout = QtWidgets.QVBoxLayout()
        self.searchTimer = QtCore.QTimer(self.parent)
        self.searchLineEdit = QtWidgets.QLineEdit(self.parent)
        self.searchBookButton = QtWidgets.QToolButton(self.parent)
        self.caseSensitiveSearchButton = QtWidgets.QToolButton(self.parent)
        self.matchWholeWordButton = QtWidgets.QToolButton(self.parent)
        self.searchResultsTreeView = QtWidgets.QTreeView(self.parent)

        self._translate = QtCore.QCoreApplication.translate
        self.search_string = self._translate('SideDock', 'Search')
        self.search_book_string = self._translate('SideDock', 'Search entire book')
        self.case_sensitive_string = self._translate('SideDock', 'Match case')
        self.match_word_string = self._translate('SideDock', 'Match word')

        self.create_widgets() 
Example 18
Project: pdash   Author: CPChain   File: input.py    GNU General Public License v3.0 6 votes vote down vote up
def style(self):
        return """
            QLineEdit{{
                padding-left: 7px;
                padding-right: 7px;
                padding-top: 2px;
                padding-bottom: 1px;
                border:1px solid #ccc;
                border-radius: 5px;
                min-height: {height}px;
                max-height: {height}px;
                background: #ffffff;
                min-width: {width}px;
                max-width: {width}px;
                font-size:14px;
                color:#9b9b9b;
            }}
        """.format(height=self.height, width=self.width) 
Example 19
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        """style is relying on object names so make sure they are set
           before registering widgets"""
        self.setObjectName('HubSearch')

        search_action = QtWidgets.QAction(self)
        search_action.setObjectName('search_action')
        close_action = QtWidgets.QAction(self)
        close_action.setObjectName('close_action')
        close_action.triggered.connect(self.cancel.emit)
        close_action.triggered.connect(self.clear)

        self.addAction(search_action, QtWidgets.QLineEdit.LeadingPosition)
        self.addAction(close_action, QtWidgets.QLineEdit.TrailingPosition)

        plexdesktop.style.Style.Instance().widget.register(search_action, 'glyphicons-search')
        plexdesktop.style.Style.Instance().widget.register(close_action, 'cancel') 
Example 20
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle('Manual Add Server')
        self.form = QtWidgets.QFormLayout(self)
        self.secure = QtWidgets.QCheckBox()
        self.address = QtWidgets.QLineEdit()
        self.port = QtWidgets.QLineEdit('32400')
        self.token = QtWidgets.QLineEdit()
        self.form.addRow(QtWidgets.QLabel('HTTPS?'), self.secure)
        self.form.addRow(QtWidgets.QLabel('Address'), self.address)
        self.form.addRow(QtWidgets.QLabel('Port'), self.port)
        self.form.addRow(QtWidgets.QLabel('Access Token (optional)'), self.token)
        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept) 
Example 21
Project: ovs-toolbox   Author: nbonnand   File: ovs-toolbox.py    Apache License 2.0 6 votes vote down vote up
def clear_widgets(wtype):
    if(debug):mydebug(inspect.currentframe())

    for w,default_value in cleanable_widget_list[wtype]:
        if(isinstance(w, QtWidgets.QLineEdit)):
            w.setText(default_value)
        elif(isinstance(w, QtWidgets.QCheckBox)):
            w.setChecked(default_value)
        elif(isinstance(w, QtWidgets.QRadioButton)):
            w.setChecked(default_value)
        elif(isinstance(w, QtWidgets.QLabel)):
            w.setText(default_value)
        elif(isinstance(w, QtWidgets.QComboBox)):
            w.setCurrentIndex(default_value)


                
#--------------------------------------------------------------- 
Example 22
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def initCellListFrame(self):
        """
        Init liberty-cell information on left sideBar.
        """
        # self.cellListFrame
        self.cellListFrame.setFrameShadow(QFrame.Raised)
        self.cellListFrame.setFrameShape(QFrame.Box)

        self.cellSelectLine = QLineEdit()
        cellSelectButton = QPushButton('Select', self.cellListFrame)
        cellSelectButton.clicked.connect(self.selectCell)

        self.cellListTree = QTreeWidget(self.cellListFrame)
        self.cellListTree.setColumnCount(1)
        self.cellListTree.setHeaderLabel('Lib->Cell')
        self.cellListTree.clicked.connect(self.cellListBeClicked)

        # self.cellListFrame - Grid
        cellListFrameGrid = QGridLayout()

        cellListFrameGrid.addWidget(self.cellSelectLine, 0, 0)
        cellListFrameGrid.addWidget(cellSelectButton, 0, 1)
        cellListFrameGrid.addWidget(self.cellListTree, 1, 0, 1, 2)

        cellListFrameGrid.setRowStretch(0, 1)
        cellListFrameGrid.setRowStretch(1, 20)
        cellListFrameGrid.setColumnStretch(0, 10)
        cellListFrameGrid.setColumnStretch(1, 1)

        self.cellListFrame.setLayout(cellListFrameGrid) 
Example 23
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def initMainFrame(self):
        """
        Init self.mainFrame.
        """
        # self.mainFram
        self.mainFrame.setFrameShadow(QFrame.Raised)
        self.mainFrame.setFrameShape(QFrame.Box)

        self.libLabel = QLabel('Lib', self.mainFrame)
        self.libLabel.setStyleSheet("font-weight: bold;")
        self.libLine = QLineEdit()

        self.cellLabel = QLabel('Cell', self.mainFrame)
        self.cellLabel.setStyleSheet("font-weight: bold;")
        self.cellLine = QLineEdit()

        self.tabWidget = QTabWidget(self.mainFrame)

        # self.mainFram - Grid
        mainFrameGrid = QGridLayout()

        mainFrameGrid.addWidget(self.libLabel, 0, 0)
        mainFrameGrid.addWidget(self.libLine, 0, 1)
        mainFrameGrid.addWidget(self.cellLabel, 1, 0)
        mainFrameGrid.addWidget(self.cellLine, 1, 1)
        mainFrameGrid.addWidget(self.tabWidget, 2, 0, 1, 2)

        mainFrameGrid.setRowStretch(0, 1)
        mainFrameGrid.setRowStretch(1, 1)
        mainFrameGrid.setRowStretch(2, 10)

        self.mainFrame.setLayout(mainFrameGrid)

        # Init self.tabWidget
        self.initTabWidget() 
Example 24
Project: pywerami   Author: ondrolexa   File: mainapp.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(OptionsForm, self).__init__(parent)
        settings = QtCore.QSettings("LX", "pywerami")
        layout = QtWidgets.QVBoxLayout(self)
        form = QtWidgets.QWidget()
        formlayout = QtWidgets.QFormLayout(form)

        ## scale
        #self.scale = QLineEdit(repr(settings.value("scale", 1, type=float)), self)
        #self.scale.setValidator(QDoubleValidator(self.scale))
        #formlayout.addRow('Scale', self.scale)

        # not-a-number
        self.nan = QtWidgets.QLineEdit(settings.value("nan", "NaN", type=str), self)
        formlayout.addRow('Not a number', self.nan)

        form.setLayout(formlayout)
        buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout.addWidget(form)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

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

        self.setWindowTitle("PyWerami options") 
Example 25
Project: dcc   Author: amimo   File: xrefwindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self,
                 parent=None,
                 win=None,
                 xrefs=None,
                 headers=["Origin", "Method"]):
        super(XrefListView, self).__init__(parent)
        self.parent = parent
        self.mainwin = win
        self.xrefs = xrefs
        self.headers = headers

        self.setMinimumSize(600, 400)

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter origin pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.xrefwindow = XrefValueWindow(self, win, self.xrefs, self.headers)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.xrefwindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 26
Project: pymovie   Author: bob-anderson-ok   File: aperturesFileTagDialog.py    MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(600, 102)
        Dialog.setMinimumSize(QtCore.QSize(400, 0))
        Dialog.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.apertureGroupTagEdit = QtWidgets.QLineEdit(Dialog)
        font = QtGui.QFont()
        font.setPointSize(13)
        self.apertureGroupTagEdit.setFont(font)
        self.apertureGroupTagEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.apertureGroupTagEdit.setMaxLength(80)
        self.apertureGroupTagEdit.setObjectName("apertureGroupTagEdit")
        self.verticalLayout.addWidget(self.apertureGroupTagEdit)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout.addWidget(self.buttonBox)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 27
Project: pymovie   Author: bob-anderson-ok   File: ocrProfileNameDialog.py    MIT License 5 votes vote down vote up
def setupUi(self, ocrNameDialog):
        ocrNameDialog.setObjectName("ocrNameDialog")
        ocrNameDialog.resize(859, 203)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(ocrNameDialog.sizePolicy().hasHeightForWidth())
        ocrNameDialog.setSizePolicy(sizePolicy)
        ocrNameDialog.setMinimumSize(QtCore.QSize(0, 0))
        ocrNameDialog.setMaximumSize(QtCore.QSize(16777215, 300))
        self.gridLayout = QtWidgets.QGridLayout(ocrNameDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(ocrNameDialog)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.profileNameEdit = QtWidgets.QLineEdit(ocrNameDialog)
        self.profileNameEdit.setObjectName("profileNameEdit")
        self.gridLayout.addWidget(self.profileNameEdit, 1, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(ocrNameDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)

        self.retranslateUi(ocrNameDialog)
        self.buttonBox.accepted.connect(ocrNameDialog.accept)
        self.buttonBox.rejected.connect(ocrNameDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(ocrNameDialog) 
Example 28
Project: kucher   Author: Zubax   File: fault_status_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def _make_line_display(self, tool_tip: str = '', is_monospace: bool = True):
        o = QLineEdit(self)
        o.setReadOnly(True)
        if is_monospace:
            o.setFont(get_monospace_font())
        o.setAlignment(Qt.AlignCenter)
        o.setToolTip(tool_tip)
        return o 
Example 29
Project: CT-Marker   Author: OoO256   File: qt.py    MIT License 5 votes vote down vote up
def addLine(self, idx, name, text, box = 'line', button = None, callback = None):
        self.grid.addWidget(QLabel(text), idx, 0)

        if box is 'line':
            self.lines[name] = QLineEdit()
            self.grid.addWidget(self.lines[name], idx, 1)
        elif box is 'text':
            self.inputs.append(QTextEdit())
            self.grid.addWidget(self.inputs[len(self.inputs) - 1], idx, 1)

        if button is not None:
            self.buttons[name] = QPushButton(button, self)
            self.grid.addWidget(self.buttons[name], idx, 2)

            self.buttons[name].clicked.connect(callback) 
Example 30
Project: Python-GUI   Author: arpitj07   File: New.py    MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(100, 40, 201, 81))
        font = QtGui.QFont()
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")

        
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(150, 190, 111, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        
        self.lineEdit = QtWidgets.QLineEdit(Form)
        self.lineEdit.setGeometry(QtCore.QRect(100, 140, 201, 22))
        self.lineEdit.setObjectName("lineEdit")

        
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 31
Project: Python-GUI   Author: arpitj07   File: openWindow.py    MIT License 5 votes vote down vote up
def setupUi(self, OpenWindow):
        OpenWindow.setObjectName("OpenWindow")
        OpenWindow.resize(535, 389)
        self.centralwidget = QtWidgets.QWidget(OpenWindow)
        self.centralwidget.setObjectName("centralwidget")
        
        self.OpenTeam = QtWidgets.QLabel(self.centralwidget)
        self.OpenTeam.setGeometry(QtCore.QRect(150, 120, 231, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.OpenTeam.setFont(font)
        self.OpenTeam.setObjectName("OpenTeam")

        
        self.OpenTheTeam = QtWidgets.QLineEdit(self.centralwidget)
        self.OpenTheTeam.setGeometry(QtCore.QRect(180, 160, 151, 22))
        self.OpenTheTeam.setObjectName("OpenTheTeam")
        
        self.openButton = QtWidgets.QPushButton(self.centralwidget)
        self.openButton.setGeometry(QtCore.QRect(210, 210, 93, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.openButton.setFont(font)
        self.openButton.setObjectName("openButton")
        
        OpenWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(OpenWindow)
        self.statusbar.setObjectName("statusbar")
        OpenWindow.setStatusBar(self.statusbar)

        self.retranslateUi(OpenWindow)
        QtCore.QMetaObject.connectSlotsByName(OpenWindow) 
Example 32
Project: pyweed   Author: iris-edu   File: OptionsWidget.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setInputValue(self, key, value):
        """
        Set the input value based on a string from the options
        """
        one_input = self.inputs.get(key)
        if one_input:
            if isinstance(one_input, QtWidgets.QDateTimeEdit):
                # Ugh, complicated conversion from UTCDateTime
                dt = QtCore.QDateTime.fromString(value, QtCore.Qt.ISODate)
                one_input.setDateTime(dt)
            elif isinstance(one_input, QtWidgets.QDoubleSpinBox):
                # Float value
                one_input.setValue(float(value))
            elif isinstance(one_input, QtWidgets.QComboBox):
                # Combo box
                index = one_input.findText(value)
                if index > -1:
                    one_input.setCurrentIndex(index)
            elif isinstance(one_input, QtWidgets.QLineEdit):
                # Text input
                one_input.setText(value)
            elif isinstance(one_input, QtWidgets.QAbstractButton):
                # Radio/checkbox button
                one_input.setChecked(strtobool(str(value)))
            else:
                raise Exception("Don't know how to set an input for %s (%s)" % (key, one_input)) 
Example 33
Project: cct   Author: awacha   File: configeditor.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def editorValue(self):
        if isinstance(self._editorwidget, QtWidgets.QPushButton):
            return self._editorwidget.isChecked()
        elif isinstance(self._editorwidget, QtWidgets.QLineEdit):
            return self._editorwidget.text()
        elif isinstance(self._editorwidget, (QtWidgets.QDoubleSpinBox, QtWidgets.QSpinBox)):
            return self._editorwidget.value()
        else:
            raise TypeError(self._editorwidget) 
Example 34
Project: cct   Author: awacha   File: settingspage.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def initSettingsPage(self, widgetsconfigs:List[Tuple[QtWidgets.QWidget, str]]):
        self._changedWidgets = []
        for widget, configname in widgetsconfigs:
            if isinstance(widget, QtWidgets.QComboBox):
                widget.currentIndexChanged.connect(self.onWidgetChanged)
            elif isinstance(widget, QtWidgets.QDoubleSpinBox) or isinstance(widget, QtWidgets.QSpinBox):
                widget.valueChanged.connect(self.onWidgetChanged)
            elif isinstance(widget, QtWidgets.QCheckBox):
                widget.toggled.connect(self.onWidgetChanged)
            elif isinstance(widget, QtWidgets.QLineEdit):
                widget.textChanged.connect(self.onWidgetChanged)
            else:
                raise ValueError('Invalid widget type: {}'.format(type(widget)))
        self._trackedWidgets = widgetsconfigs 
Example 35
Project: musaic   Author: al165   File: main.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, engine, *args, **kwargs):
        super().__init__(*args, **kwargs)

        print('[ClientOptions]', 'init')

        self._engine = engine

        self.setWindowTitle('musAIc options...')

        layout = QtWidgets.QVBoxLayout()
        form_layout = QtWidgets.QFormLayout()
        layout.addLayout(form_layout)

        self._addr = QtWidgets.QLineEdit(str(self._engine.clientOptions['addr']))
        self._addr.setInputMask('000.000.000.000')
        self._port = QtWidgets.QSpinBox()# str(self._engine.clientOptions['port']))
        self._port.setRange(1024, 65535)
        self._port.setValue(self._engine.clientOptions['port'])
        self._clock = QtWidgets.QCheckBox()
        self._clock.setChecked(self._engine.clientOptions['clock'])

        form_layout.addRow('Address:', self._addr)
        form_layout.addRow('Port:', self._port)
        form_layout.addRow('Send clock:', self._clock)


        buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout.addWidget(buttons)

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

        self.setLayout(layout) 
Example 36
Project: PyQt5-Wamp   Author: icefo   File: PyQt5_GUI.py    MIT License 5 votes vote down vote up
def __init__(self, parent):
        # this allow the use of the parent's methods when needed
        super(MainWidget, self).__init__(parent=parent)

        self.number_1 = QLineEdit()
        self.number_2 = QLineEdit()

        self.addition_button = QPushButton("push to add !")
        self.addition_result = QLineEdit()

        self.widget_init() 
Example 37
Project: MeiTingTrunk   Author: Xunius   File: folder_tree.py    GNU General Public License v3.0 5 votes vote down vote up
def createEditor(self, parent, option, index):
        '''To disable typing in invalid chars in the folder name'''

        editor = QtWidgets.QLineEdit(parent)
        reg=QtCore.QRegExp('[A-z0-9\[\]_-\s]+')
        vd=QRegExpValidator(reg)
        editor.setValidator(vd)

        return editor 
Example 38
Project: MeiTingTrunk   Author: Xunius   File: choose_app_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, title, app_type, settings, parent=None):

        super(self.__class__,self).__init__(parent=parent)

        self.settings=settings

        self.setWindowTitle(title)
        self.resize(300,100)

        va=QtWidgets.QVBoxLayout(self)

        label=QtWidgets.QLabel('Give the command to launch editor (E.g. vim)')
        va.addWidget(label)


        default=self.settings.value(app_type, type=str)
        self.le=QtWidgets.QLineEdit(self)
        self.le.setText(default)

        #self.choose_button=QtWidgets.QPushButton('Choose')
        #self.choose_button.clicked.connect(self.chooseButtonClicked)

        ha=QtWidgets.QHBoxLayout()
        ha.addWidget(self.le)
        #ha.addWidget(self.choose_button)

        va.addLayout(ha)

        self.buttons=QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                Qt.Horizontal, self)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        va.addWidget(self.buttons) 
Example 39
Project: MeiTingTrunk   Author: Xunius   File: meta_tab.py    GNU General Public License v3.0 5 votes vote down vote up
def resizeEvent(self, event):

        super(QtWidgets.QLineEdit, self).resizeEvent(event)
        if hasattr(self,'full_text'):
            self.setText(self.full_text,elide=True) 
Example 40
Project: eddy   Author: obdasystems   File: description.py    GNU General Public License v3.0 5 votes vote down vote up
def initUI(self):
        #############################################
        # URL BOX
        #################################
        self.URLLabel = QtWidgets.QLabel(self)
        self.URLLabel.setFont(Font('Roboto', 12))
        self.URLLabel.setText('URL Image')
        self.insertBoxURL = QtWidgets.QLineEdit(self)
        self.insertBoxURL.setMaximumHeight(40)

        #############################################
        # CONFIRMATION BOX
        #################################
        self.confirmationBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok |
                                                          QtWidgets.QDialogButtonBox.Cancel, self)
        self.confirmationBox.setContentsMargins(10, 0, 10, 10)
        self.confirmationBox.setFont(Font('Roboto', 12))

        #############################################
        # DIALOG WINDOW LAYOUT
        #################################
        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.URLLabel)
        self.layout.addWidget(self.insertBoxURL)
        self.layout.addWidget(self.confirmationBox, 5, QtCore.Qt.AlignRight)

        self.setMaximumSize(350, 150)
        self.setWindowTitle("Insert URL")
        self.setLayout(self.layout)

        self.setWindowModality(QtCore.Qt.WindowModal)

    ############################################################
    # PROPERTIES
    ############################################################ 
Example 41
Project: BBoxEE   Author: persts   File: coco_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.setWindowTitle('COCO Information')
        self.setMinimumSize(500, 0)
        self.setModal(True)
        date_created = datetime.datetime.now().strftime('%Y-%m-%d %H:%S:%I')
        self.info = {'description': '',
                     'url': '',
                     'version': '',
                     'year': '',
                     'contributor': '',
                     'date_created': date_created}
        self.desc = QtWidgets.QLineEdit()
        self.desc.textChanged.connect(self.update)
        self.url = QtWidgets.QLineEdit()
        self.url.textChanged.connect(self.update)
        self.version = QtWidgets.QLineEdit()
        self.version.textChanged.connect(self.update)
        self.year = QtWidgets.QLineEdit()
        self.year.textChanged.connect(self.update)
        self.contrib = QtWidgets.QLineEdit()
        self.contrib.textChanged.connect(self.update)

        layout = QtWidgets.QFormLayout(self)
        layout.addRow("Description", self.desc)
        layout.addRow("Url", self.url)
        layout.addRow("Version", self.version)
        layout.addRow("Year", self.year)
        layout.addRow("Contributor", self.contrib) 
Example 42
Project: confidential-debt-simplification   Author: ric2b   File: ui_login.py    GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, LoginDialog):
        LoginDialog.setObjectName("LoginDialog")
        LoginDialog.resize(401, 80)
        self.verticalLayout = QtWidgets.QVBoxLayout(LoginDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.password_label = QtWidgets.QLabel(LoginDialog)
        self.password_label.setObjectName("password_label")
        self.horizontalLayout_3.addWidget(self.password_label)
        self.password_line = QtWidgets.QLineEdit(LoginDialog)
        self.password_line.setText("")
        self.password_line.setMaxLength(256)
        self.password_line.setEchoMode(QtWidgets.QLineEdit.Password)
        self.password_line.setReadOnly(False)
        self.password_line.setObjectName("password_line")
        self.horizontalLayout_3.addWidget(self.password_line)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.buttonBox = QtWidgets.QDialogButtonBox(LoginDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)
        self.password_label.setBuddy(self.password_line)

        self.retranslateUi(LoginDialog)
        self.buttonBox.accepted.connect(LoginDialog.accept)
        self.buttonBox.rejected.connect(LoginDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(LoginDialog) 
Example 43
Project: confidential-debt-simplification   Author: ric2b   File: ui_invite.py    GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, InviteDialog):
        InviteDialog.setObjectName("InviteDialog")
        InviteDialog.resize(443, 115)
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(InviteDialog)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.id_label = QtWidgets.QLabel(InviteDialog)
        self.id_label.setObjectName("id_label")
        self.verticalLayout_2.addWidget(self.id_label)
        self.email_label = QtWidgets.QLabel(InviteDialog)
        self.email_label.setObjectName("email_label")
        self.verticalLayout_2.addWidget(self.email_label)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.id_lineedit = QtWidgets.QLineEdit(InviteDialog)
        self.id_lineedit.setPlaceholderText("")
        self.id_lineedit.setObjectName("id_lineedit")
        self.verticalLayout.addWidget(self.id_lineedit)
        self.email_lineedit = QtWidgets.QLineEdit(InviteDialog)
        self.email_lineedit.setMaxLength(160)
        self.email_lineedit.setObjectName("email_lineedit")
        self.verticalLayout.addWidget(self.email_lineedit)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.verticalLayout_3.addLayout(self.horizontalLayout)
        self.button_box = QtWidgets.QDialogButtonBox(InviteDialog)
        self.button_box.setOrientation(QtCore.Qt.Horizontal)
        self.button_box.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.button_box.setObjectName("button_box")
        self.verticalLayout_3.addWidget(self.button_box)
        self.id_label.setBuddy(self.id_lineedit)
        self.email_label.setBuddy(self.email_lineedit)

        self.retranslateUi(InviteDialog)
        self.button_box.accepted.connect(InviteDialog.accept)
        self.button_box.rejected.connect(InviteDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(InviteDialog) 
Example 44
Project: dunya-desktop   Author: MTG   File: filteringdialog.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.attribute = None
        self.setFixedSize(200, 300)

        self.setWindowFlags(Qt.FramelessWindowHint | Qt.Popup)

        v_layout = QVBoxLayout(self)
        self.filtering_edit = QLineEdit()
        self.table_attribute = TableView()

        self.button_box = QDialogButtonBox(self)
        self.button_box.addButton('OK', QDialogButtonBox.AcceptRole)
        self.button_box.addButton('Cancel', QDialogButtonBox.RejectRole)

        v_layout.addWidget(self.filtering_edit)
        v_layout.addWidget(self.table_attribute)
        v_layout.addWidget(self.button_box)

        self.setLayout(v_layout)

        self.filtering_model = FilteringModel(self)

        self.proxy_model = SortFilterProxyModel(self)
        self.proxy_model.setSourceModel(self.filtering_model)
        self.proxy_model.setFilterKeyColumn(-1)

        self.table_attribute.horizontalHeader().hide()
        self.table_attribute.setModel(self.proxy_model)
        self.table_attribute.setColumnWidth(0, 28)

        self.filtering_edit.setPlaceholderText('Type here to filter...')
        self.selection = -1

        self.filtering_edit.textChanged.connect(
            lambda: self.proxy_model.filter_table(self.filtering_edit.text()))

        self.button_box.rejected.connect(self.clicked_cancel)
        self.table_attribute.doubleClicked.connect(
            self.get_selected_item_index)
        self.button_box.accepted.connect(self.get_selected_item_index) 
Example 45
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, media_object, parent=None):
        super().__init__(parent)
        self.setWindowTitle('Preferences')
        self.form = QtWidgets.QFormLayout(self)
        server = media_object.container.server
        settings = server.container(media_object.key)
        self.ids = []
        for item in settings['_children']:
            itype = item['type']
            if itype == 'bool':
                input_widget = QtWidgets.QCheckBox()
                input_widget.setCheckState(QtCore.Qt.Checked if item['value'] == 'true' else QtCore.Qt.Unchecked)
            elif itype == 'enum':
                input_widget = QtWidgets.QComboBox()
                input_widget.addItems(item['values'].split('|'))
                input_widget.setCurrentIndex(int(item['value']))
            elif itype == 'text':
                input_widget = QtWidgets.QLineEdit(item['value'])
                if item['secure'] == 'true':
                    input_widget.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
            else:
                input_widget = QtWidgets.QLabel('...')
            self.form.addRow(QtWidgets.QLabel(item['label']), input_widget)
            self.ids.append((item['id'], input_widget))

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)
        if self.exec_() == QtWidgets.QDialog.Accepted:
            media_object.container.server.request(media_object.key + '/set', params=self.extract_values()) 
Example 46
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 5 votes vote down vote up
def extract_values(self):
        values = {}
        for pid, widget in self.ids:
            if isinstance(widget, QtWidgets.QLineEdit):
                values[pid] = widget.text()
            elif isinstance(widget, QtWidgets.QComboBox):
                values[pid] = widget.currentIndex()
            elif isinstance(widget, QtWidgets.QCheckBox):
                values[pid] = 'true' if widget.checkState() == QtCore.Qt.Checked else 'false'
        return values 
Example 47
Project: plexdesktop   Author: coryo   File: extra_widgets.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        s = plexdesktop.settings.Settings()
        self.setWindowTitle('Preferences')
        self.form = QtWidgets.QFormLayout(self)

        i = QtWidgets.QComboBox()
        i.addItems(plexdesktop.style.Style.Instance().themes)
        i.setCurrentIndex(i.findText(s.value('theme')))
        self.form.addRow(QtWidgets.QLabel('theme'), i)

        bf = QtWidgets.QSpinBox()
        bf.setValue(int(s.value('browser_font', 9)))
        self.form.addRow(QtWidgets.QLabel('browser font size'), bf)

        icon_size = QtWidgets.QLineEdit(str(s.value('thumb_size', 240)))
        icon_size.setValidator(QtGui.QIntValidator(0, 300))
        self.form.addRow(QtWidgets.QLabel('thumbnail size'), icon_size)

        widget_player = QtWidgets.QCheckBox()
        widget_player.setCheckState(QtCore.Qt.Checked if bool(int(s.value('widget_player', 0))) else QtCore.Qt.Unchecked)
        self.form.addRow(QtWidgets.QLabel('use widget player'), widget_player)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        self.form.addRow(self.buttons)
        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)

        if self.exec_() == QtWidgets.QDialog.Accepted:
            # s = Settings()
            theme = i.currentText()
            s.setValue('theme', theme)
            plexdesktop.style.Style.Instance().theme(theme)

            s.setValue('browser_font', bf.value())

            s.setValue('thumb_size', int(icon_size.text()))

            s.setValue('widget_player', 1 if widget_player.checkState() == QtCore.Qt.Checked else 0) 
Example 48
Project: plexdesktop   Author: coryo   File: login_ui.py    GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Login):
        Login.setObjectName("Login")
        Login.resize(234, 101)
        self.verticalLayout = QtWidgets.QVBoxLayout(Login)
        self.verticalLayout.setObjectName("verticalLayout")
        self.formLayout_2 = QtWidgets.QFormLayout()
        self.formLayout_2.setObjectName("formLayout_2")
        self.username = QtWidgets.QLineEdit(Login)
        self.username.setObjectName("username")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.username)
        self.password = QtWidgets.QLineEdit(Login)
        self.password.setEchoMode(QtWidgets.QLineEdit.Password)
        self.password.setObjectName("password")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.password)
        self.label = QtWidgets.QLabel(Login)
        self.label.setObjectName("label")
        self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label)
        self.label_2 = QtWidgets.QLabel(Login)
        self.label_2.setObjectName("label_2")
        self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_2)
        self.buttonBox = QtWidgets.QDialogButtonBox(Login)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.buttonBox)
        self.verticalLayout.addLayout(self.formLayout_2)

        self.retranslateUi(Login)
        self.buttonBox.accepted.connect(Login.accept)
        self.buttonBox.rejected.connect(Login.reject)
        QtCore.QMetaObject.connectSlotsByName(Login) 
Example 49
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def setup_newmod(self):
        """ Setup the newmod tab on the MainWindow """
        self.newmod = QtWidgets.QWidget()
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.newmod.setFont(font)
        self.newmod.setObjectName("newmod")
        self.grid_newmod = QtWidgets.QGridLayout(self.newmod)
        self.grid_newmod.setObjectName("grid_newmod")
        self.newmod_options = QtWidgets.QGroupBox(self.newmod)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.newmod_options.setFont(font)
        self.newmod_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.newmod_options.setObjectName("newmod_options")
        self.grid_newmod_options = QtWidgets.QGridLayout(self.newmod_options)
        self.grid_newmod_options.setObjectName("grid_newmod_options")
        self.label_newmod_modname = QtWidgets.QLabel(self.newmod_options)
        self.label_newmod_modname.setObjectName("label_newmod_modname")
        self.grid_newmod_options.addWidget(self.label_newmod_modname, 0, 0, 1, 1)
        self.newmod_run = QtWidgets.QPushButton(self.newmod_options)
        self.newmod_run.setToolTip("")
        self.newmod_run.setDefault(False)
        self.newmod_run.setFlat(False)
        self.newmod_run.setObjectName("newmod_run")
        self.grid_newmod_options.addWidget(self.newmod_run, 1, 0, 1, 1)
        self.newmod_modname = QtWidgets.QLineEdit(self.newmod_options)
        self.newmod_modname.setObjectName("newmod_modname")
        self.grid_newmod_options.addWidget(self.newmod_modname, 0, 1, 1, 1)
        self.grid_newmod.addWidget(self.newmod_options, 0, 1, 1, 1)
        self.commands.addTab(self.newmod, "") 
Example 50
Project: modtool_gui   Author: swap-nil7   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def setup_disable(self):
        """ Setup disable tab in the MainWindow """
        self.disable = QtWidgets.QWidget()
        self.disable.setObjectName("disable")
        self.grid_disable = QtWidgets.QGridLayout(self.disable)
        self.grid_disable.setObjectName("grid_disable")
        self.disable_options = QtWidgets.QGroupBox(self.disable)
        font = QtGui.QFont()
        font.setFamily("Carlito")
        font.setPointSize(12)
        font.setBold(False)
        font.setWeight(50)
        self.disable_options.setFont(font)
        self.disable_options.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.disable_options.setObjectName("disable_options")
        self.grid_disable_options = QtWidgets.QGridLayout(self.disable_options)
        self.grid_disable_options.setObjectName("grid_disable_options")
        self.disable_run = QtWidgets.QPushButton(self.disable_options)
        self.disable_run.setToolTip("")
        self.disable_run.setDefault(False)
        self.disable_run.setFlat(False)
        self.disable_run.setObjectName("disable_run")
        self.grid_disable_options.addWidget(self.disable_run, 2, 0, 1, 1)
        self.label_disable_blockname = QtWidgets.QLabel(self.disable_options)
        self.label_disable_blockname.setObjectName("label_disable_blockname")
        self.grid_disable_options.addWidget(self.label_disable_blockname, 0, 0, 1, 1)
        self.disable_blockname = QtWidgets.QLineEdit(self.disable_options)
        self.disable_blockname.setObjectName("disable_blockname")
        self.grid_disable_options.addWidget(self.disable_blockname, 0, 2, 1, 1)
        self.grid_disable.addWidget(self.disable_options, 0, 0, 1, 1)
        self.disable_candidates = QtWidgets.QGroupBox(self.disable)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.disable_candidates.setFont(font)
        self.disable_candidates.setObjectName("disable_candidates")
        self.grid_disable.addWidget(self.disable_candidates, 0, 1, 1, 1)
        self.commands.addTab(self.disable, "")