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


Python QLineEdit.setSizePolicy方法代碼示例

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


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

示例1: CueGeneral

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

    Name = 'Cue'

    def __init__(self, size, cue=None, parent=None):
        super().__init__(size, cue=cue, parent=parent)

        self.setLayout(QVBoxLayout(self))

        # Groups
        self.groupGroups = QGroupBox(self)
        self.groupGroups.setTitle("Edit groups")
        self.horizontalLayout_5 = QHBoxLayout(self.groupGroups)

        self.editGroups = QLineEdit(self.groupGroups)
        regex = QtCore.QRegExp('(\d+,)*')
        self.editGroups.setValidator(QRegExpValidator(regex))
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.editGroups.setSizePolicy(sizePolicy)
        self.horizontalLayout_5.addWidget(self.editGroups)

        self.groupsEditLabel = QLabel(self.groupGroups)
        self.groupsEditLabel.setText("Modify groups [0,1,2,...,n]")
        self.groupsEditLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.horizontalLayout_5.addWidget(self.groupsEditLabel)

        self.layout().addWidget(self.groupGroups)

    def get_configuration(self):
        conf = {}

        checkable = self.groupGroups.isCheckable()

        if(not (checkable and not self.groupGroups.isChecked())):
            groups_str = self.editGroups.text().split(',')
            if(groups_str[-1] != ''):
                conf['groups'] = [int(groups_str[-1])]
            else:
                conf['groups'] = []
            conf['groups'] += [int(g) for g in groups_str[:-1]]

        return conf

    def enable_check(self, enable):
        self.groupGroups.setCheckable(enable)
        self.groupGroups.setChecked(False)

    def set_configuration(self, conf):
        if('groups' in conf):
            self.editGroups.setText(str(conf['groups'])[1:-1])
開發者ID:tornel,項目名稱:linux-show-player,代碼行數:52,代碼來源:cue_general.py

示例2: StringParameterWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class StringParameterWidget(GenericParameterWidget):
    """Widget class for string parameter."""
    def __init__(self, parameter, parent=None):
        """Constructor

        .. versionadded:: 2.2

        :param parameter: A StringParameter object.
        :type parameter: StringParameter

        """
        super().__init__(parameter, parent)

        self._line_edit_input = QLineEdit()
        self._line_edit_input.setSizePolicy(
            QSizePolicy.Minimum, QSizePolicy.Fixed)
        # Tooltips
        self.setToolTip('Write the value for %s here ' % self._parameter.name)
        self._line_edit_input.setText(self._parameter.value)

        self.inner_input_layout.addWidget(self._line_edit_input)

    def get_parameter(self):
        """Obtain string parameter object from the current widget state.

        :returns: A StringParameter from the current state of widget
        """
        value = self._line_edit_input.text()
        if value.__class__.__name__ == 'QString':
            value = str(value)
        self._parameter.value = value
        return self._parameter

    def set_text(self, text):
        """Update the text of the widget

        :param text: The new text
        :type text: str
        """
        self._line_edit_input.setText(text)
開發者ID:inasafe,項目名稱:parameters,代碼行數:42,代碼來源:string_parameter_widget.py

示例3: SheetDockWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class SheetDockWidget(QDockWidget):
    def __init__(self):
        super().__init__("Sheets")

        # Create main widget for content and layout of Dockwidget
        self.mainWidget = QWidget()
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.mainWidgetLayout = QGridLayout(self.mainWidget)
        self.mainWidgetLayout.setSizeConstraint(QGridLayout.SetDefaultConstraint)

        # - Create frame for button and entry
        self.newSheetWidget = QWidget(self.mainWidget)
        self.newSheetWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        self.newSheetWidgetLayout = QFormLayout(self.newSheetWidget)
        self.newSheetWidgetLayout.setContentsMargins(0, 0, 0, 0)

        self.newSheetButton = QPushButton(self.newSheetWidget)
        self.newSheetButton.setText("Create")
        self.newSheetButton.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.newSheetWidgetLayout.setWidget(0, QFormLayout.LabelRole, self.newSheetButton)

        self.newSheetLineedit = QLineEdit(self.newSheetWidget)
        #self.newSheetLineedit.setEditable(True)
        self.newSheetLineedit.setToolTip("Enter name for new sheet")
        self.newSheetLineedit.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        self.newSheetWidgetLayout.setWidget(0, QFormLayout.FieldRole, self.newSheetLineedit)

        self.mainWidgetLayout.addWidget(self.newSheetWidget, 0, 0, 1, 1)

        # - Add worker treeview to content
        self.sheetTree = QTreeWidget(self.mainWidget)
        self.sheetTree.setColumnCount(1)

        self.sheetTree.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.mainWidgetLayout.addWidget(self.sheetTree, 1, 0, 1, 1)

        # Set dockwidget content to main widget
        self.setWidget(self.mainWidget)
開發者ID:DrLuke,項目名稱:gpnshader,代碼行數:40,代碼來源:dockwidgets.py

示例4: CustomDateRangePanel

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class CustomDateRangePanel(Panel):
    FIELDS = [
        ('startDateEdit', 'start_date'),
        ('endDateEdit', 'end_date'),
        ('slotIndexComboBox', 'slot_index'),
        ('slotNameEdit', 'slot_name'),
    ]
    PERSISTENT_NAME = 'customDateRangePanel'

    def __init__(self, model, mainwindow):
        Panel.__init__(self, mainwindow)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self._setupUi()
        self.model = model

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

    def _setupUi(self):
        self.setWindowTitle(tr("Custom Date Range"))
        self.resize(292, 86)
        self.setModal(True)
        self.verticalLayout = QVBoxLayout(self)
        self.label = QLabel(tr("Select start and end dates from your custom range:"))
        self.verticalLayout.addWidget(self.label)
        self.horizontalLayout = QHBoxLayout()
        self.label_2 = QLabel(tr("Start:"))
        self.horizontalLayout.addWidget(self.label_2)
        self.startDateEdit = DateEdit(self)
        self.horizontalLayout.addWidget(self.startDateEdit)
        self.label_3 = QLabel(tr("End:"))
        self.horizontalLayout.addWidget(self.label_3)
        self.endDateEdit = DateEdit(self)
        self.horizontalLayout.addWidget(self.endDateEdit)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QHBoxLayout()
        self.label_4 = QLabel(tr("Save this range under slot:"))
        self.horizontalLayout_2.addWidget(self.label_4)
        self.slotIndexComboBox = QComboBox(self)
        sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.slotIndexComboBox.sizePolicy().hasHeightForWidth())
        self.slotIndexComboBox.setSizePolicy(sizePolicy)
        for s in [tr("None"), tr("#1"), tr("#2"), tr("#3")]:
            self.slotIndexComboBox.addItem(s)
        self.horizontalLayout_2.addWidget(self.slotIndexComboBox)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3 = QHBoxLayout()
        self.label_5 = QLabel(tr("Under the name:"))
        self.horizontalLayout_3.addWidget(self.label_5)
        self.slotNameEdit = QLineEdit(self)
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.slotNameEdit.sizePolicy().hasHeightForWidth())
        self.slotNameEdit.setSizePolicy(sizePolicy)
        self.horizontalLayout_3.addWidget(self.slotNameEdit)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.verticalLayout.addWidget(self.buttonBox)
開發者ID:daleathan,項目名稱:moneyguru,代碼行數:67,代碼來源:custom_date_range_panel.py

示例5: TopWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class TopWidget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.last_music_btn = QPushButton()
        self.next_music_btn = QPushButton()
        self.play_pause_btn = QPushButton()
        self.search_edit = QLineEdit()
        self.login_btn = QPushButton("->")
        self.login_label = LoginLabel()
        self.show_current_list = QPushButton()
        self.edit_layout = QHBoxLayout()

        self.music_info_container = MusicInfoWidget()

        self.top_layout = QHBoxLayout()
        self.bottom_layout = QHBoxLayout()
        self.layout = QVBoxLayout()

        self.setLayout(self.layout)
        self.set_widgets_prop()
        self.set_layouts_prop()
        self.init_widget()

    def paintEvent(self, QPaintEvent):
        """
        self is derived from QWidget, Stylesheets don't work unless \
        paintEvent is reimplemented.y
        at the same time, if self is derived from QFrame, this isn't needed.
        """
        option = QStyleOption()
        option.initFrom(self)
        painter = QPainter(self)
        style = self.style()
        style.drawPrimitive(QStyle.PE_Widget, option, painter, self)

    def init_widget(self):
        self.login_label.close()
        self.music_info_container.love_music_btn.close()
        self.music_info_container.play_mv_btn.close()

    def set_widgets_prop(self):
        self.login_btn.setToolTip(u'登錄')

        self.login_label.setFixedSize(30, 30)
        self.login_btn.setFixedSize(30, 30)
        self.show_current_list.setFixedSize(30, 30)
        self.show_current_list.setToolTip(u'顯示當前播放列表')

        self.search_edit.setFixedHeight(30)
        self.search_edit.setPlaceholderText(u'搜索歌曲')
        self.search_edit.setAttribute(Qt.WA_MacShowFocusRect, False)
        self.search_edit.setSizePolicy(
                QSizePolicy.Minimum, QSizePolicy.Minimum)

        self.play_pause_btn.setCheckable(True)
        self.play_pause_btn.setChecked(True)

        self.music_info_container.setFixedHeight(57)
        self.setFixedHeight(57)

        self.set_object_name()

    def set_object_name(self):
        self.play_pause_btn.setObjectName('play_pause')
        self.last_music_btn.setObjectName('last')
        self.next_music_btn.setObjectName('next')
        self.login_btn.setObjectName('login_btn')
        self.login_label.setObjectName('login_label')
        self.show_current_list.setObjectName('show_current_list')

    def set_layouts_prop(self):
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)

        self.top_layout.addSpacing(10)
        self.top_layout.addWidget(self.last_music_btn)
        self.top_layout.addSpacing(10)
        self.top_layout.addWidget(self.play_pause_btn)
        self.top_layout.addSpacing(10)
        self.top_layout.addWidget(self.next_music_btn)
        self.top_layout.addSpacing(30)  # make table widget
        self.top_layout.addWidget(self.music_info_container)
        self.top_layout.addSpacing(20)  # make table widget
        self.top_layout.addWidget(self.search_edit)
        self.top_layout.addSpacing(10)
        self.top_layout.addWidget(self.show_current_list)
        self.top_layout.addSpacing(10)
        self.top_layout.addWidget(self.login_btn)
        self.top_layout.addSpacing(10)
        self.top_layout.addWidget(self.login_label)
        self.top_layout.addSpacing(5)

        self.layout.addLayout(self.top_layout)
        self.layout.addLayout(self.bottom_layout)
        self.layout.addSpacing(3)
開發者ID:1635594911,項目名稱:FeelUOwn,代碼行數:97,代碼來源:top_widget.py

示例6: DebugViewer

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class DebugViewer(QWidget):
    """
    Class implementing a widget conatining various debug related views.
    
    The individual tabs contain the interpreter shell (optional),
    the filesystem browser (optional), the two variables viewers
    (global and local), a breakpoint viewer, a watch expression viewer and
    the exception logger. Additionally a list of all threads is shown.
    
    @signal sourceFile(string, int) emitted to open a source file at a line
    """
    sourceFile = pyqtSignal(str, int)
    
    def __init__(self, debugServer, docked, vm, parent=None,
                 embeddedShell=True, embeddedBrowser=True):
        """
        Constructor
        
        @param debugServer reference to the debug server object
        @param docked flag indicating a dock window
        @param vm reference to the viewmanager object
        @param parent parent widget (QWidget)
        @param embeddedShell flag indicating whether the shell should be
            included. This flag is set to False by those layouts, that have
            the interpreter shell in a separate window.
        @param embeddedBrowser flag indicating whether the file browser should
            be included. This flag is set to False by those layouts, that
            have the file browser in a separate window or embedded
            in the project browser instead.
        """
        super(DebugViewer, self).__init__(parent)
        
        self.debugServer = debugServer
        self.debugUI = None
        
        self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
        
        self.__mainLayout = QVBoxLayout()
        self.__mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.__mainLayout)
        
        self.__tabWidget = E5TabWidget()
        self.__mainLayout.addWidget(self.__tabWidget)
        
        self.embeddedShell = embeddedShell
        if embeddedShell:
            from QScintilla.Shell import ShellAssembly
            # add the interpreter shell
            self.shellAssembly = ShellAssembly(debugServer, vm, False)
            self.shell = self.shellAssembly.shell()
            index = self.__tabWidget.addTab(
                self.shellAssembly,
                UI.PixmapCache.getIcon("shell.png"), '')
            self.__tabWidget.setTabToolTip(index, self.shell.windowTitle())
        
        self.embeddedBrowser = embeddedBrowser
        if embeddedBrowser:
            from UI.Browser import Browser
            # add the browser
            self.browser = Browser()
            index = self.__tabWidget.addTab(
                self.browser,
                UI.PixmapCache.getIcon("browser.png"), '')
            self.__tabWidget.setTabToolTip(index, self.browser.windowTitle())
        
        from .VariablesViewer import VariablesViewer
        # add the global variables viewer
        self.glvWidget = QWidget()
        self.glvWidgetVLayout = QVBoxLayout(self.glvWidget)
        self.glvWidgetVLayout.setContentsMargins(0, 0, 0, 0)
        self.glvWidgetVLayout.setSpacing(3)
        self.glvWidget.setLayout(self.glvWidgetVLayout)
        
        self.globalsViewer = VariablesViewer(self.glvWidget, True)
        self.glvWidgetVLayout.addWidget(self.globalsViewer)
        
        self.glvWidgetHLayout = QHBoxLayout()
        self.glvWidgetHLayout.setContentsMargins(3, 3, 3, 3)
        
        self.globalsFilterEdit = QLineEdit(self.glvWidget)
        self.globalsFilterEdit.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.glvWidgetHLayout.addWidget(self.globalsFilterEdit)
        self.globalsFilterEdit.setToolTip(
            self.tr("Enter regular expression patterns separated by ';'"
                    " to define variable filters. "))
        self.globalsFilterEdit.setWhatsThis(
            self.tr("Enter regular expression patterns separated by ';'"
                    " to define variable filters. All variables and"
                    " class attributes matched by one of the expressions"
                    " are not shown in the list above."))
        
        self.setGlobalsFilterButton = QPushButton(
            self.tr('Set'), self.glvWidget)
        self.glvWidgetHLayout.addWidget(self.setGlobalsFilterButton)
        self.glvWidgetVLayout.addLayout(self.glvWidgetHLayout)
        
        index = self.__tabWidget.addTab(
            self.glvWidget,
            UI.PixmapCache.getIcon("globalVariables.png"), '')
#.........這裏部分代碼省略.........
開發者ID:Darriall,項目名稱:eric,代碼行數:103,代碼來源:DebugViewer.py

示例7: GroupsActionSettings

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

    Name = 'Cue Settings'

    ACTIONS = ['Play', 'Pause', 'Stop', 'Auto']

    def __init__(self, size, cue=None, parent=None):
        super().__init__(size, cue=cue, parent=parent)

        self.setLayout(QVBoxLayout(self))

        # Groups
        self.groupGroups = QGroupBox(self)
        self.groupGroups.setTitle("Edit groups")
        self.ggHLayout = QHBoxLayout(self.groupGroups)

        self.editGroups = QLineEdit(self.groupGroups)
        regex = QtCore.QRegExp('(\d+,)*')
        self.editGroups.setValidator(QRegExpValidator(regex))
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
        self.editGroups.setSizePolicy(sizePolicy)
        self.ggHLayout.addWidget(self.editGroups)

        self.groupsEditLabel = QLabel(self.groupGroups)
        self.groupsEditLabel.setText("Modify groups [0,1,2,...,n]")
        self.groupsEditLabel.setAlignment(QtCore.Qt.AlignCenter)
        self.ggHLayout.addWidget(self.groupsEditLabel)

        self.layout().addWidget(self.groupGroups)

        # Action
        self.groupAction = QGroupBox(self)
        self.groupAction.setTitle("Select action")
        self.gaHLayout = QHBoxLayout(self.groupAction)

        self.actionsBox = QComboBox(self.groupAction)
        self.actionsBox.addItems(self.ACTIONS)
        self.gaHLayout.addWidget(self.actionsBox)

        self.layout().addWidget(self.groupAction)
        self.layout().addSpacing(self.height() - 200)

    def get_configuration(self):
        conf = {}

        checkable = self.groupGroups.isCheckable()

        if not (checkable and not self.groupGroups.isChecked()):
            groups_str = self.editGroups.text().split(',')
            if groups_str[-1] != '':
                conf['groups'] = [int(groups_str[-1])]
            else:
                conf['groups'] = []
            conf['groups'] += [int(g) for g in groups_str[:-1]]
        if not (checkable and not self.groupAction.isChecked()):
            conf['action'] = self.actionsBox.currentText()

        return conf

    def enable_check(self, enable):
        self.groupGroups.setCheckable(enable)
        self.groupGroups.setChecked(False)

        self.groupAction.setCheckable(enable)
        self.groupAction.setChecked(False)

    def set_configuration(self, conf):
        if 'groups' in conf:
            self.editGroups.setText(str(conf['groups'])[1:-1])
        if 'action' in conf and conf['action'] in self.ACTIONS:
            self.actionsBox.setCurrentIndex(self.ACTIONS.index(conf['action']))
開發者ID:tornel,項目名稱:linux-show-player,代碼行數:73,代碼來源:groups_action.py

示例8: EditView

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

#.........這裏部分代碼省略.........
        return QTextCursor(self.Editor.textCursor())
    # Return the essence of the cursor as a tuple (pos,anc)
    def get_cursor_val(self):
        return (self.Editor.textCursor().position(), self.Editor.textCursor.anchor())
    # Some other code likes to reposition the edit selection:
    def set_cursor(self, tc):
        self.Editor.setTextCursor(tc)
    # Make a valid cursor based on position and anchor values possibly
    # input by the user.
    def make_cursor(self, position, anchor):
        mx = self.document.characterCount()
        tc = QTextCursor(self.Editor.textCursor())
        anchor = min( max(0,anchor), mx )
        position = min ( max(0,position), mx )
        tc.setPosition(anchor)
        tc.setPosition(position,QTextCursor.KeepAnchor)
        return tc

    # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    #            INITIALIZE UI
    #
    # First we built the Edit panel using Qt Creator which produced a large
    # and somewhat opaque block of code that had to be mixed in by
    # multiple inheritance. This had several drawbacks, so the following
    # is a "manual" UI setup using code drawn from the generated code.
    #
    def _uic(self):
        # First set up the properties of "self", a QWidget.
        self.setObjectName("EditViewWidget")
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(False) # don't care to bind height to width
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QSize(250, 250))
        self.setFocusPolicy(Qt.StrongFocus)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.setWindowTitle("")
        self.setToolTip("")
        self.setStatusTip("")
        self.setWhatsThis("")
        # Set up our primary widget, the editor
        self.Editor = PTEditor(self,self.my_book)
        self.Editor.setObjectName("Editor")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(2) # Edit deserves all available space
        sizePolicy.setVerticalStretch(2)
        sizePolicy.setHeightForWidth(False)
        self.Editor.setSizePolicy(sizePolicy)
        self.Editor.setFocusPolicy(Qt.StrongFocus)
        self.Editor.setContextMenuPolicy(Qt.NoContextMenu)
        self.Editor.setAcceptDrops(True)
        self.Editor.setLineWidth(2)
        self.Editor.setDocumentTitle("")
        self.Editor.setLineWrapMode(QPlainTextEdit.NoWrap)

        # Set up the frame that will contain the bottom row of widgets
        # It doesn't need a parent and doesn't need to be a class member
        # because it will be added to a layout, which parents it.
        bot_frame = QFrame()
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        bot_frame.setSizePolicy(sizePolicy)
        bot_frame.setMinimumSize(QSize(0, 24))
開發者ID:B-Rich,項目名稱:PPQT2,代碼行數:70,代碼來源:editview.py

示例9: MainWindow

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

        self.start_logo()

        self.setupUi(self)
        self.sysencoding =sys.stdout.encoding
        #self.centralWidget = PyPreviewer(self)
        #self.setCentralWidget(self.centralWidget)
        self.setupEditor()

        self.setWindowIcon(QIcon('PyPreviewer.ico'))


        #메뉴 이벤트 생성
        self.createEvent()

        self.dirty = False
        self.plainTextEdit_2.textChanged.connect(self.setDirty)
        self.fileName = None
        self.plainTextEdit_2.setTabStopWidth(35)
        self.plainTextEdit_2.setPlainText("# -*- coding: utf-8 -*-\n# 반갑습니다~\n# #은 파이썬에서 주석입니다.\nprint(\"이 부분은 출력창입니다.\")\nprint(\"구구단 예제\")\nfor i in range(2,10):\n\tprint(i,\"단\")\n\tfor j in range(2,10):\n\t\tprint(i,\"X\", j, \"=\", i*j)\n# 파이썬 실행은 아래 실행버튼을 눌러주세요.\n# 파이썬 학습 관련 및 예제는 왼쪽 화면을 이용하시기 바랍니다.")

        #web view
        #self.exampleView.load(QUrl("http://www.google.com"))
        self.startfilepath=os.getcwd() +"/PyStudy_web/Main.html"
        self.exampleView.load(QUrl.fromLocalFile(self.startfilepath))
        self.locationEdit = QLineEdit(self)
        self.locationEdit.setSizePolicy(QSizePolicy.Expanding,
                self.locationEdit.sizePolicy().verticalPolicy())
        self.locationEdit.returnPressed.connect(self.changeLocation)

        toolBar = QToolBar()
        self.addToolBar(toolBar)
        self.insertToolBarBreak(toolBar)
        toolBar.addAction(self.exampleView.pageAction(QWebPage.Back))
        toolBar.addAction(self.exampleView.pageAction(QWebPage.Forward))
        toolBar.addAction(self.action_myHome)
        toolBar.addAction(self.exampleView.pageAction(QWebPage.Reload))
        #toolBar.addAction(self.exampleView.pageAction(QWebPage.Stop))
        toolBar.addWidget(self.locationEdit)



        #사용자 입력 파이썬 파일 실행
        print ('Connecting process')
        self.process = QProcess(self)
        self.process.setProcessChannelMode(QProcess.SeparateChannels)
        self.process.setInputChannelMode(QProcess.ManagedInputChannel)

        self.process.readyReadStandardOutput.connect(self.stdoutReady)
        self.process.readyReadStandardError.connect(self.stderrReady)
        self.process.started.connect(lambda: print('ExampleProgramStarted!'))
        self.process.finished.connect(lambda:print('ExampleProgramFinished!'))
        print('Starting process')
        #self.process.start('python', ['ExampleTest.py'])

    def start_logo(self):
        img_logo = QPixmap('pystudylogo.png')
        self.splash = QSplashScreen(img_logo, Qt.WindowStaysOnTopHint)
        self.splash.setMask(img_logo.mask())
        self.splash.show()
        time.sleep(1.8)
        self.splash.close()
    def show_logo(self):
        img_logo = QPixmap('pystudylogo.png')
        self.splash = QSplashScreen(img_logo, Qt.WindowStaysOnTopHint)
        self.splash.setMask(img_logo.mask())
        self.splash.show()
        self.splash.repaint()
    def createEvent(self):
        self.ProgramRunButton.clicked.connect(self.clickAction_ProgramRunButton)
        self.ProgramStopButton.clicked.connect(self.clickAction_ProgramStopButton)
        self.actionRun.triggered.connect(self.clickAction_ProgramRunButton)
        self.actionStop.triggered.connect(self.clickAction_ProgramStopButton)
        self.ClearButton.clicked.connect(self.clickAction_ProgramEraseButton)
        self.actionClear.triggered.connect(self.clickAction_ProgramEraseButton)
        self.actionNew_File.triggered.connect(self.clickAction_fileNew)
        self.actionFile_Open.triggered.connect(self.clickAction_fileOpen)
        self.actionFile_Save.triggered.connect(self.clickAction_fileSave)
        self.actionFile_Save_as.triggered.connect(self.clickAction_fileSaveAs)
        self.action_example.triggered.connect(self.clickAction_exampleOpen)
        self.actionPythonHelp.triggered.connect(self.clickAction_PythonHelp)
        self.actionHelp.triggered.connect(self.clickAction_ProgramHelp)
        self.MessagepushButton.clicked.connect(self.clickAction_MessagePushButton)
        self.actionStyleSheet_default.triggered.connect(self.clickAction_styleDefault)
        self.actionStyleSheet_Black.triggered.connect(self.clickAction_styleBlack)
        self.actionStyleSheet_Load.triggered.connect(self.clickAction_styleLoad)
        self.actionAbout_PyStudy.triggered.connect(self.show_logo)
        self.action_myHome.triggered.connect(self.go_myHome)
        self.action_exit.triggered.connect(self.close)
    def setDirty(self):
        #'On change of text in textEdit window, set the flag "dirty" to True''
        if self.dirty:
            return True
        self.dirty = True
        self.updateStatus('소스 수정중...')

    def clearDirty(self):
#.........這裏部分代碼省略.........
開發者ID:louisraccoon,項目名稱:PyStudy,代碼行數:103,代碼來源:PyPreviewer.py

示例10: WindowUI

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

    def widgetSource(self):
        """Create source widget.
        """
        hbox = QHBoxLayout()
        sourceLabel = QLabel(self.tr('Source'))

        self.sourceCBox = QComboBox(self)
        self.sourcePath = QLineEdit(self)
        self.sourcePath.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
#        self.sourcePath.setMinimumWidth(400)
        self.sourcePathButton = QPushButton('...')
        self.sourcePathButton.setMaximumWidth(40)

        self.playButton = QPushButton('')
        self.nextFrameButton = QPushButton('')
        self.refreshButton = QPushButton('')

        css = "QPushButton { border: none; }" \
            "QPushButton:pressed { border: 1px solid #555; background-color: #222; }"

        size = QtCore.QSize(23, 23)

        self.playButton.setIcon(QIcon('assets/pause.png'))
        self.playButton.setIconSize(size)
        self.playButton.setMinimumSize(size)
        self.playButton.setMaximumSize(size)
        self.playButton.setStyleSheet(css)

        self.refreshButton.setIcon(QIcon('assets/refresh.png'))
        self.refreshButton.setIconSize(size)
        self.refreshButton.setMinimumSize(size)
        self.refreshButton.setMaximumSize(size)
        self.refreshButton.setStyleSheet(css)


        self.nextFrameButton.setIcon(QIcon('assets/next.png'))
        self.nextFrameButton.setIconSize(size)
        self.nextFrameButton.setMinimumSize(size)
        self.nextFrameButton.setMaximumSize(size)
        self.nextFrameButton.setStyleSheet(css)

        self.sourceCBox.setCurrentIndex(0)

        controlsHbox = QHBoxLayout()
        controlsHbox.addWidget(self.playButton)
        controlsHbox.addWidget(self.nextFrameButton)
        controlsHbox.addWidget(self.refreshButton)
        controlsHbox.setAlignment(QtCore.Qt.AlignRight)

        hbox.addWidget(sourceLabel)
        hbox.addWidget(self.sourceCBox)
        hbox.addWidget(self.sourcePath)
        hbox.addWidget(self.sourcePathButton)
        hbox.addLayout(controlsHbox)
        hbox.setAlignment(QtCore.Qt.AlignLeft)
        return hbox

    def widgetFrame(self):
        """Create main display widget.
        """
        vbox = QVBoxLayout()
        scroll = QScrollArea()
        scroll.setAlignment(QtCore.Qt.AlignCenter)
        self.mediaLabel = QLabel(self)
        scroll.setWidget(self.mediaLabel)
        vbox.addWidget(scroll)
        return vbox

    def widgetTree(self):
        """Create selected objects tree.
        """
        tree = QTreeView()
        tree.header().setHidden(True)
        tree.setDragEnabled(True)
        tree.setSelectionMode(QAbstractItemView.ExtendedSelection)
        tree.setDefaultDropAction(QtCore.Qt.MoveAction)
        tree.setDragDropMode(QAbstractItemView.InternalMove)
        tree.setAcceptDrops(True)
        tree.setDropIndicatorShown(True)
        return tree

    def widgetObjectList(self):
        """Create objects list widget.
        """
        self.objectsTree = self.widgetTree()
        self.availableObjectsList = QListWidget(self)
        self.availableObjectsList.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.removeButton = QPushButton(self.tr('>>'))
        self.addButton = QPushButton(self.tr('<<'))

        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addWidget(self.addButton)
        vbox.addWidget(self.removeButton)
        vbox.addStretch(1)

        vboxSelected = QVBoxLayout()
        selectedLabel = QLabel(self.tr('Selected'))
#.........這裏部分代碼省略.........
開發者ID:smajida,項目名稱:detection,代碼行數:103,代碼來源:window_ui.py

示例11: EditView

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

#.........這裏部分代碼省略.........
        return QTextCursor(self.Editor.textCursor())
    # Return the essence of the cursor as a tuple (pos,anc)
    def get_cursor_val(self):
        return (self.Editor.textCursor().position(), self.Editor.textCursor().anchor())
    # Some other code likes to reposition the edit selection:
    def set_cursor(self, tc):
        self.Editor.setTextCursor(tc)
    # Make a valid cursor based on position and anchor values possibly
    # input by the user.
    def make_cursor(self, position, anchor):
        mx = self.document.characterCount()
        tc = QTextCursor(self.Editor.textCursor())
        anchor = min( max(0,anchor), mx )
        position = min ( max(0,position), mx )
        tc.setPosition(anchor)
        tc.setPosition(position,QTextCursor.KeepAnchor)
        return tc

    # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    #            INITIALIZE UI
    #
    # First we built the Edit panel using Qt Creator which produced a large
    # and somewhat opaque block of code that had to be mixed in by
    # multiple inheritance. This had several drawbacks, so the following
    # is a "manual" UI setup using code drawn from the generated code.
    #
    def _uic(self):
        # First set up the properties of "self", a QWidget.
        self.setObjectName("EditViewWidget")
        sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(False) # don't care to bind height to width
        self.setSizePolicy(sizePolicy)
        self.setMinimumSize(QSize(250, 250))
        self.setFocusPolicy(Qt.StrongFocus)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.setWindowTitle("")
        self.setToolTip("")
        self.setStatusTip("")
        self.setWhatsThis("")
        # Set up our primary widget, the editor
        self.Editor = PTEditor(self,self.my_book)
        self.Editor.setObjectName("Editor")
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(2) # Edit deserves all available space
        sizePolicy.setVerticalStretch(2)
        sizePolicy.setHeightForWidth(False)
        self.Editor.setSizePolicy(sizePolicy)
        self.Editor.setFocusPolicy(Qt.StrongFocus)
        self.Editor.setContextMenuPolicy(Qt.NoContextMenu)
        self.Editor.setAcceptDrops(True)
        self.Editor.setLineWidth(2)
        self.Editor.setDocumentTitle("")
        self.Editor.setLineWrapMode(QPlainTextEdit.NoWrap)

        # Set up the frame that will contain the bottom row of widgets
        # It doesn't need a parent and doesn't need to be a class member
        # because it will be added to a layout, which parents it.
        bot_frame = QFrame()
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(False)
        bot_frame.setSizePolicy(sizePolicy)
        bot_frame.setMinimumSize(QSize(0, 24))
開發者ID:tallforasmurf,項目名稱:PPQT2,代碼行數:70,代碼來源:editview.py

示例12: RatukiWidget

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

    def createEngine(self):
        if self.game != 'Ratuki':
            raise Exception("No engine for game {}".format(self.game))
            return
        self.engine = RatukiEngine()

    def initUI(self):
        super(RatukiWidget, self).initUI()

        self.gameInput = RatukiInputWidget(self.engine, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.roundLayout.addWidget(self.gameInput)

        self.configLayout = QGridLayout()
        self.matchGroupLayout.addLayout(self.configLayout)
        self.topPointsLineEdit = QLineEdit(self.matchGroup)
        self.topPointsLineEdit.setText(str(self.engine.getTop()))
        self.topPointsLineEdit.setValidator(
            QtGui.QIntValidator(1, 10000, self.topPointsLineEdit))
        self.topPointsLineEdit.setFixedWidth(50)
        sp = QSizePolicy(
            QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.topPointsLineEdit.setSizePolicy(sp)
        self.topPointsLineEdit.textChanged.connect(self.changeTop)
        self.topPointsLineEdit.setDisabled(self.engine.getNumRound() > 1)
        self.configLayout.addWidget(self.topPointsLineEdit, 0, 0)

        self.topPointsLabel = QLabel(self.matchGroup)
        self.topPointsLabel.setStyleSheet("QLabel {font-weight: bold; }")
        self.configLayout.addWidget(self.topPointsLabel, 0, 1)

        self.detailGroup = RatukiRoundsDetail(self.engine, self)
        self.detailGroup.edited.connect(self.updatePanel)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        for i, player in enumerate(self.players):
            pw = GamePlayerWidget(player, PlayerColours[i], self.playerGroup)
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            if player == self.engine.getDealer():
                pw.setDealer()
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()

        self.retranslateUI()

    def retranslateUI(self):
        super(RatukiWidget, self).retranslateUI()
        self.topPointsLabel.setText(
            i18n("RatukiWidget", "Score Limit"))
#         self.playerGroup.setTitle(i18n("RatukiWidget","Score"))
        self.detailGroup.retranslateUI()

    def checkPlayerScore(self, player, score): return True

    def unsetDealer(
        self): self.playerGroupBox[self.engine.getDealer()].unsetDealer()

    def setDealer(
        self): self.playerGroupBox[self.engine.getDealer()].setDealer()

    def updatePanel(self):
        self.topPointsLineEdit.setReadOnly(True)
        self.dealerPolicyCheckBox.setEnabled(False)
        for player in self.players:
            score = self.engine.getScoreFromPlayer(player)
            self.playerGroupBox[player].updateDisplay(score)

        if self.engine.getWinner():
            self.detailGroup.updateStats()
        self.detailGroup.updateRound()
        super(RatukiWidget, self).updatePanel()

    def changeTop(self, newtop):
        try:
            newtop = int(newtop)
            self.engine.setTop(newtop)
            self.detailGroup.updatePlot()
        except ValueError:
            pass

    def setWinner(self):
        super(RatukiWidget, self).setWinner()
        winner = self.engine.getWinner()
        if winner in self.players:
            self.playerGroupBox[winner].setWinner()

    def updatePlayerOrder(self):
        GameWidget.updatePlayerOrder(self)
#.........這裏部分代碼省略.........
開發者ID:trawl,項目名稱:gamelog,代碼行數:103,代碼來源:ratuki.py

示例13: FileEdit

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class FileEdit(QWidget):
    filePathChanged = pyqtSignal(str)

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

        self.mFilter = ''
        self.mErrorTextColor = Qt.red

        layout = QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        self.mLineEdit = QLineEdit(self)
        self.mLineEdit.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred))
        self.mOkTextColor = self.mLineEdit.palette().color(QPalette.Active, QPalette.Text)
        button = QToolButton(self)
        button.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred))
        button.setFixedWidth(20)
        button.setText("...")
        layout.addWidget(self.mLineEdit)
        layout.addWidget(button)
        self.setFocusProxy(self.mLineEdit)
        self.setFocusPolicy(Qt.StrongFocus)
        self.setAttribute(Qt.WA_InputMethodEnabled)
        self.mLineEdit.textEdited.connect(self.filePathChanged)
        self.mLineEdit.textChanged.connect(self.validate)
        button.clicked.connect(self.buttonClicked)

    def setFilePath(self, filePath):
         if (self.mLineEdit.text() != filePath):
             self.mLineEdit.setText(filePath)

    def filePath(self):
        return self.mLineEdit.text()

    def setFilter(self, filter):
        self.mFilter = filter

    def focusInEvent(self, e):
        self.mLineEdit.event(e)
        if (e.reason() == Qt.TabFocusReason or e.reason() == Qt.BacktabFocusReason):
            self.mLineEdit.selectAll()

        super().focusInEvent(e)

    def focusOutEvent(self, e):
        self.mLineEdit.event(e)
        super().focusOutEvent(e)

    def keyPressEvent(self, e):
        self.mLineEdit.event(e)

    def keyReleaseEvent(self, e):
        self.mLineEdit.event(e)

    def validate(self, text):
        if QFile.exists(text):
            textColor = self.mOkTextColor
        else:
            textColor = self.mErrorTextColor
        palette = self.mLineEdit.palette()
        palette.setColor(QPalette.Active, QPalette.Text, textColor)
        self.mLineEdit.setPalette(palette)

    def buttonClicked(self):
        filePath, _ = QFileDialog.getOpenFileName(self.window(), self.tr("Choose a File"), self.mLineEdit.text(), self.mFilter)
        if filePath=='':
            return
        self.mLineEdit.setText(filePath)
        self.filePathChanged.emit(filePath)
開發者ID:theall,項目名稱:Python-Tiled,代碼行數:72,代碼來源:fileedit.py

示例14: RemigioWidget

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

    bgcolors = [0, 0xCCFF99, 0xFFFF99, 0xFFCC99, 0xFFCCFF]

    def createEngine(self):
        if self.game != 'Remigio':
            raise Exception("No engine for game {}".format(self.game))
            return
        self.engine = RemigioEngine()

    def initUI(self):
        super(RemigioWidget, self).initUI()

        self.gameInput = RemigioInputWidget(
            self.engine, RemigioWidget.bgcolors, self)
        self.gameInput.enterPressed.connect(self.commitRound)
        self.roundLayout.addWidget(self.gameInput)

        self.configLayout = QGridLayout()
        self.matchGroupLayout.addLayout(self.configLayout)
        self.topPointsLineEdit = QLineEdit(self.matchGroup)
        self.topPointsLineEdit.setText(str(self.engine.getTop()))
        self.topPointsLineEdit.setValidator(
            QtGui.QIntValidator(1, 10000, self.topPointsLineEdit))
        self.topPointsLineEdit.setFixedWidth(50)
        sp = QSizePolicy(
            QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.topPointsLineEdit.setSizePolicy(sp)
        self.topPointsLineEdit.textChanged.connect(self.changeTop)
        self.topPointsLineEdit.setDisabled(self.engine.getNumRound() > 1)
        self.configLayout.addWidget(self.topPointsLineEdit, 0, 0)

        self.topPointsLabel = QLabel(self.matchGroup)
        self.topPointsLabel.setStyleSheet("QLabel {font-weight: bold; }")
        self.configLayout.addWidget(self.topPointsLabel, 0, 1)

        self.detailGroup = RemigioRoundsDetail(
            self.engine, RemigioWidget.bgcolors, self)
        self.detailGroup.edited.connect(self.updatePanel)
#         self.detailGroup = GameRoundsDetail(self.engine, self)
        self.widgetLayout.addWidget(self.detailGroup, 1, 0)

        self.playerGroup = QGroupBox(self)
        self.widgetLayout.addWidget(self.playerGroup, 1, 1)

        self.playerGroup.setStyleSheet(
            "QGroupBox { font-size: 18px; font-weight: bold; }")
        self.playersLayout = QVBoxLayout(self.playerGroup)
        self.playersLayout.addStretch()
        self.playerGroupBox = {}
        for i, player in enumerate(self.players):
            pw = RemigioPlayerWidget(
                player, PlayerColours[i % len(PlayerColours)],
                self.playerGroup)
            pw.updateDisplay(self.engine.getScoreFromPlayer(player))
            if player == self.engine.getDealer():
                pw.setDealer()
            if self.engine.isPlayerOff(player):
                print("Should set {} to ko...".format(player))
                pw.koPlayer()
            self.playersLayout.addWidget(pw)
            self.playerGroupBox[player] = pw

        self.playersLayout.addStretch()

        self.retranslateUI()

    def retranslateUI(self):
        super(RemigioWidget, self).retranslateUI()
        self.topPointsLabel.setText(
            i18n("RemigioWidget", "Score Limit"))
#         self.playerGroup.setTitle(i18n("RemigioWidget","Score"))
        self.detailGroup.retranslateUI()

    def updateGameStatusLabel(self):
        super(RemigioWidget, self).updateGameStatusLabel()
        if self.gameStatusLabel.text() == "":
            self.gameStatusLabel.setStyleSheet("QLabel {font-weight:bold;}")
            msg = i18n("RemigioWidget", "Warning: real points are computed \
                        automatically depending on the close type")
            self.gameStatusLabel.setText(msg)

    def getPlayerExtraInfo(self, player):
        c_type = self.gameInput.getCloseType()
        if c_type:
            return {'closeType': c_type}
        else:
            return {}

    def unsetDealer(
        self): self.playerGroupBox[self.engine.getDealer()].unsetDealer()

    def setDealer(
        self): self.playerGroupBox[self.engine.getDealer()].setDealer()

    def updatePanel(self):
        self.topPointsLineEdit.setReadOnly(True)
        self.dealerPolicyCheckBox.setEnabled(False)
        self.updateScores()
        if self.engine.getWinner():
#.........這裏部分代碼省略.........
開發者ID:trawl,項目名稱:gamelog,代碼行數:103,代碼來源:remigio.py

示例15: PreferencesDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setSizePolicy [as 別名]
class PreferencesDialog(PreferencesDialogBase):
    def _setupPreferenceWidgets(self):
        self._setupFilterHardnessBox()
        self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
        self.widget = QWidget(self)
        self.widget.setMinimumSize(QSize(0, 136))
        self.verticalLayout_4 = QVBoxLayout(self.widget)
        self._setupAddCheckbox('wordWeightingBox', tr("Word weighting"), self.widget)
        self.verticalLayout_4.addWidget(self.wordWeightingBox)
        self._setupAddCheckbox('matchSimilarBox', tr("Match similar words"), self.widget)
        self.verticalLayout_4.addWidget(self.matchSimilarBox)
        self._setupAddCheckbox('mixFileKindBox', tr("Can mix file kind"), self.widget)
        self.verticalLayout_4.addWidget(self.mixFileKindBox)
        self._setupAddCheckbox('useRegexpBox', tr("Use regular expressions when filtering"), self.widget)
        self.verticalLayout_4.addWidget(self.useRegexpBox)
        self._setupAddCheckbox('removeEmptyFoldersBox', tr("Remove empty folders on delete or move"), self.widget)
        self.verticalLayout_4.addWidget(self.removeEmptyFoldersBox)
        self.horizontalLayout_2 = QHBoxLayout()
        self._setupAddCheckbox('ignoreSmallFilesBox', tr("Ignore files smaller than"), self.widget)
        self.horizontalLayout_2.addWidget(self.ignoreSmallFilesBox)
        self.sizeThresholdEdit = QLineEdit(self.widget)
        sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizeThresholdEdit.sizePolicy().hasHeightForWidth())
        self.sizeThresholdEdit.setSizePolicy(sizePolicy)
        self.sizeThresholdEdit.setMaximumSize(QSize(50, 16777215))
        self.horizontalLayout_2.addWidget(self.sizeThresholdEdit)
        self.label_6 = QLabel(self.widget)
        self.label_6.setText(tr("KB"))
        self.horizontalLayout_2.addWidget(self.label_6)
        spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem1)
        self.verticalLayout_4.addLayout(self.horizontalLayout_2)
        self._setupAddCheckbox(
            'ignoreHardlinkMatches',
            tr("Ignore duplicates hardlinking to the same file"), self.widget
        )
        self.verticalLayout_4.addWidget(self.ignoreHardlinkMatches)
        self._setupAddCheckbox('debugModeBox', tr("Debug mode (restart required)"), self.widget)
        self.verticalLayout_4.addWidget(self.debugModeBox)
        self.widgetsVLayout.addWidget(self.widget)
        self._setupBottomPart()

    def _load(self, prefs, setchecked):
        setchecked(self.matchSimilarBox, prefs.match_similar)
        setchecked(self.wordWeightingBox, prefs.word_weighting)
        setchecked(self.ignoreSmallFilesBox, prefs.ignore_small_files)
        self.sizeThresholdEdit.setText(str(prefs.small_file_threshold))

        # Update UI state based on selected scan type
        scan_type = prefs.get_scan_type(AppMode.Standard)
        word_based = scan_type == ScanType.Filename
        self.filterHardnessSlider.setEnabled(word_based)
        self.matchSimilarBox.setEnabled(word_based)
        self.wordWeightingBox.setEnabled(word_based)

    def _save(self, prefs, ischecked):
        prefs.match_similar = ischecked(self.matchSimilarBox)
        prefs.word_weighting = ischecked(self.wordWeightingBox)
        prefs.ignore_small_files = ischecked(self.ignoreSmallFilesBox)
        prefs.small_file_threshold = tryint(self.sizeThresholdEdit.text())
開發者ID:hsoft,項目名稱:dupeguru,代碼行數:64,代碼來源:preferences_dialog.py


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