Python PyQt5.QtCore.Qt.NoFocus() Examples
The following are 25
code examples of PyQt5.QtCore.Qt.NoFocus().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: customwidget.py From python with Apache License 2.0 | 7 votes |
def initUI(self): OVER_CAPACITY = 750 sld = QSlider(Qt.Horizontal, self) sld.setFocusPolicy(Qt.NoFocus) sld.setRange(1, OVER_CAPACITY) sld.setValue(75) sld.setGeometry(30, 40, 150, 30) self.c = Communicate() self.wid = BurningWidget() self.c.updateBW[int].connect(self.wid.setValue) sld.valueChanged[int].connect(self.changeValue) hbox = QHBoxLayout() hbox.addWidget(self.wid) vbox = QVBoxLayout() vbox.addStretch(1) vbox.addLayout(hbox) self.setLayout(vbox) self.setGeometry(300, 300, 390, 210) self.setWindowTitle('Burning widget') self.show()
Example #2
Source File: playing_mediawidget.py From linux-show-player with GNU General Public License v3.0 | 7 votes |
def __init__(self, cue, **kwargs): super().__init__(cue, **kwargs) self.setGeometry(0, 0, self.width(), 110) self._dbmeter_element = None self.seekSlider = QClickSlider(self.gridLayoutWidget) self.seekSlider.setOrientation(Qt.Horizontal) self.seekSlider.setRange(0, cue.duration) self.seekSlider.setFocusPolicy(Qt.NoFocus) self.seekSlider.sliderMoved.connect(self._seek) self.seekSlider.sliderJumped.connect(self._seek) self.seekSlider.setVisible(False) self.dbmeter = QDbMeter(self.gridLayoutWidget) self.dbmeter.setVisible(False) cue.changed('duration').connect(self._update_duration, Connection.QtQueued)
Example #3
Source File: downloadview.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
def __init__(self, model, parent=None): super().__init__(parent) if not utils.is_mac: self.setStyle(QStyleFactory.create('Fusion')) stylesheet.set_register(self) self.setResizeMode(QListView.Adjust) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed) self.setFocusPolicy(Qt.NoFocus) self.setFlow(QListView.LeftToRight) self.setSpacing(1) self._menu = None model.rowsInserted.connect(functools.partial(update_geometry, self)) model.rowsRemoved.connect(functools.partial(update_geometry, self)) model.dataChanged.connect(functools.partial(update_geometry, self)) self.setModel(model) self.setWrapping(True) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.show_context_menu) self.clicked.connect(self.on_clicked)
Example #4
Source File: matplotlib_embedded3.py From mmvt with GNU General Public License v3.0 | 6 votes |
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.m = m = PlotCanvas(self, width=5, height=4) m.move(0,0) sld = QSlider(Qt.Vertical, self) sld.setFocusPolicy(Qt.NoFocus) sld.setGeometry(500, 40, 100, 90) sld.valueChanged[int].connect(self.changeValue) # button.setToolTip('This s an example button') # button.move(500,0) # button.resize(140,100) self.show()
Example #5
Source File: playing_list_widget.py From linux-show-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, running_model, **kwargs): super().__init__(**kwargs) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setFocusPolicy(Qt.NoFocus) self.setSelectionMode(self.NoSelection) self._running_cues = {} self._running_model = running_model self._running_model.item_added.connect( self._item_added, Connection.QtQueued) self._running_model.item_removed.connect( self._item_removed, Connection.QtQueued) self._running_model.model_reset.connect( self._model_reset, Connection.QtQueued) self.__dbmeter_visible = False self.__seek_visible = False self.__accurate_time = False
Example #6
Source File: FilterCvQtContainer.py From bjtu_BinocularCameraRecord with MIT License | 6 votes |
def setParameters(self, minValue, maxValue): # Creates the slider for the OpenCV filter, with min, max, default and # step values self.thresh_sld = QSlider(Qt.Horizontal, self) self.thresh_sld.setFocusPolicy(Qt.NoFocus) self.thresh_sld.setMinimum(minValue) self.thresh_sld.setMaximum(maxValue) self.thresh_sld.setValue(self.k[0]) self.thresh_sld.setSingleStep(2)
Example #7
Source File: common.py From awesometts-anki-addon with GNU General Public License v3.0 | 6 votes |
def __init__(self, target, tooltip, sequence, text=None, style=None): """ Initializes the button and wires its 'clicked' event. Note that buttons that have text get one set of styling different from ones without text. """ super().__init__(ICON, text, signal_name='clicked', target=target) if text: self.setIconSize(QtCore.QSize(15, 15)) else: self.setFixedWidth(20) self.setFixedHeight(20) self.setFocusPolicy(Qt.NoFocus) self.setShortcut(sequence) self.setToolTip(self.tooltip_text(tooltip, sequence)) if style: self.setStyle(style)
Example #8
Source File: info_panel.py From linux-show-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, **kwargs): super().__init__(**kwargs) self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.__cue = None # cue name self.cueName = QLineEdit(self) self.cueName.setFocusPolicy(Qt.NoFocus) self.cueName.setReadOnly(True) self.layout().addWidget(self.cueName) # cue description self.cueDescription = QTextEdit(self) self.cueDescription.setObjectName('InfoPanelDescription') self.cueDescription.setFocusPolicy(Qt.NoFocus) self.cueDescription.setReadOnly(True) self.layout().addWidget(self.cueDescription) self.retranslateUi()
Example #9
Source File: textclient.py From bluesky with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super().__init__(parent) self.setMinimumHeight(150) self.setReadOnly(True) self.setFocusPolicy(Qt.NoFocus)
Example #10
Source File: main.py From controleEstoque with MIT License | 5 votes |
def botaoReceberParcela(self, tabela, row, col, funcao, texto, status): item = QtWidgets.QPushButton() # item.setFixedWidth(70) # item.setFixedHeight(30) item.setCursor(QtGui.QCursor(Qt.PointingHandCursor)) if status == 1: item.setDisabled(True) item.setFocusPolicy(Qt.NoFocus) item.setFlat(Qt.NoItemFlags) item.setStyleSheet("QPushButton{\n" "background-color: #7AB32E;\n" "border-radius: 2px;\n" "padding: 2px;\n" "border: none;\n" "text-transform: uppercase;\n" "font: 10px \"Arial\";\n" "}\n" "QPushButton:hover{\n" "background-color: #40a286\n" "}" ) item.setText(texto) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(10) item.setFont(font) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap( self.resourcepath('Images/money.png')), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon1) tabela.setCellWidget(row, col, item) item.clicked.connect(funcao) # Input receber/pagar parcela compra e venda
Example #11
Source File: main.py From controleEstoque with MIT License | 5 votes |
def botaoRemoveItem(self, tabela, row, col, funcao, bg): item = QtWidgets.QPushButton() # item.setFixedWidth(30) # item.setFixedHeight(30) item.setCursor(QtGui.QCursor(Qt.PointingHandCursor)) item.setFocusPolicy(Qt.NoFocus) item.setFlat(Qt.NoItemFlags) item.setStyleSheet("QPushButton{\n" "background-color: " + bg + ";\n" "border-radius: 2px;\n" "padding: 2px;\n" "}\n" "QPushButton:hover{\n" "background-color: #40a286\n" "}") item.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap( self.resourcepath('Images/edit-delete.png')), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon1) tabela.setCellWidget(row, col, item) item.clicked.connect(funcao) # data e Status entrega tabela compra / venda
Example #12
Source File: main.py From controleEstoque with MIT License | 5 votes |
def botaoTabela(self, tabela, row, col, funcao, bg): item = QtWidgets.QPushButton() # item.setFixedWidth(30) # item.setFixedHeight(30) item.setCursor(QtGui.QCursor(Qt.PointingHandCursor)) item.setFocusPolicy(Qt.NoFocus) item.setFlat(Qt.NoItemFlags) item.setStyleSheet("QPushButton{\n" "background-color: #1E87F0;\n" "border-radius: 2px;\n" "padding: 2px;\n" "color: #FFF;\n" "font: 10px \"Tahoma\" Bold\n" "}\n" "QPushButton:hover{\n" "background-color: #40a286\n" "}") item.setText("EDITAR") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap( self.resourcepath('Images/editar.png')), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon1) tabela.setCellWidget(row, col, item) item.clicked.connect(funcao) # Botão Remove Item
Example #13
Source File: history.py From gridsync with GNU General Public License v3.0 | 5 votes |
def __init__(self, gateway, deduplicate=True, max_items=30): super(HistoryListWidget, self).__init__() self.gateway = gateway self.deduplicate = deduplicate self.max_items = max_items palette = self.palette() self.base_color = palette.base().color() self.highlighted_color = BlendedColor( self.base_color, palette.highlight().color(), 0.88 ) # Was #E6F1F7 self.highlighted = None self.action_icon = QIcon(resource("dots-horizontal-triple.png")) self.setContextMenuPolicy(Qt.CustomContextMenu) self.setFocusPolicy(Qt.NoFocus) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) # self.setSelectionMode(QAbstractItemView.ExtendedSelection) self.setSelectionMode(QAbstractItemView.NoSelection) # self.setStyleSheet("QListWidget::item:hover { background: #E6F1F7 }") self.setVerticalScrollMode(QAbstractItemView.ScrollPerPixel) self.sb = self.verticalScrollBar() self.sb.valueChanged.connect(self.update_visible_widgets) self.itemDoubleClicked.connect(self.on_double_click) self.customContextMenuRequested.connect(self.on_right_click) self.gateway.monitor.file_updated.connect(self.add_item) self.gateway.monitor.check_finished.connect( self.update_visible_widgets )
Example #14
Source File: pid_dialogs.py From artisan with GNU General Public License v3.0 | 5 votes |
def createsegmenttable(self): self.segmenttable.setRowCount(16) self.segmenttable.setColumnCount(4) self.segmenttable.setHorizontalHeaderLabels([QApplication.translate("StatusBar","SV",None), QApplication.translate("StatusBar","Ramp (MM:SS)",None), QApplication.translate("StatusBar","Soak (MM:SS)",None),""]) self.segmenttable.setEditTriggers(QTableWidget.NoEditTriggers) self.segmenttable.setSelectionBehavior(QTableWidget.SelectRows) self.segmenttable.setSelectionMode(QTableWidget.SingleSelection) self.segmenttable.setShowGrid(True) self.segmenttable.verticalHeader().setSectionResizeMode(2) regextime = QRegExp(r"^-?[0-9]?[0-9]?[0-9]:[0-5][0-9]$") #populate table for i in range(16): #create widgets svkey = "segment" + str(i+1) + "sv" rampkey = "segment" + str(i+1) + "ramp" soakkey = "segment" + str(i+1) + "soak" svedit = QLineEdit(str(self.aw.fujipid.PXG4[svkey][0])) svedit.setValidator(self.aw.createCLocaleDoubleValidator(0., 999., 1, svedit)) rampedit = QLineEdit(stringfromseconds(self.aw.fujipid.PXG4[rampkey][0])) rampedit.setValidator(QRegExpValidator(regextime,self)) soakedit = QLineEdit(stringfromseconds(self.aw.fujipid.PXG4[soakkey][0])) soakedit.setValidator(QRegExpValidator(regextime,self)) setButton = QPushButton(QApplication.translate("Button","Set",None)) setButton.setFocusPolicy(Qt.NoFocus) setButton.clicked.connect(self.setsegment) #add widgets to the table self.segmenttable.setCellWidget(i,0,svedit) self.segmenttable.setCellWidget(i,1,rampedit) self.segmenttable.setCellWidget(i,2,soakedit) self.segmenttable.setCellWidget(i,3,setButton) #idn = id number, sv = float set value, ramp = ramp value, soak = soak value
Example #15
Source File: pid_dialogs.py From artisan with GNU General Public License v3.0 | 5 votes |
def createsegmenttable(self): self.segmenttable.setRowCount(8) self.segmenttable.setColumnCount(4) self.segmenttable.setHorizontalHeaderLabels([QApplication.translate("Table","SV",None), QApplication.translate("Table","Ramp HH:MM",None), QApplication.translate("Table","Soak HH:MM",None),""]) self.segmenttable.setEditTriggers(QTableWidget.NoEditTriggers) self.segmenttable.setSelectionBehavior(QTableWidget.SelectRows) self.segmenttable.setSelectionMode(QTableWidget.SingleSelection) self.segmenttable.setShowGrid(True) self.segmenttable.verticalHeader().setSectionResizeMode(2) regextime = QRegExp(r"^-?[0-9]?[0-9]?[0-9]:[0-5][0-9]$") #populate table for i in range(8): #create widgets svkey = "segment" + str(i+1) + "sv" rampkey = "segment" + str(i+1) + "ramp" soakkey = "segment" + str(i+1) + "soak" svedit = QLineEdit(str(self.aw.fujipid.PXR[svkey][0])) svedit.setValidator(self.aw.createCLocaleDoubleValidator(0., 999., 1, svedit)) rampedit = QLineEdit(stringfromseconds(self.aw.fujipid.PXR[rampkey][0])) rampedit.setValidator(QRegExpValidator(regextime,self)) soakedit = QLineEdit(stringfromseconds(self.aw.fujipid.PXR[soakkey][0])) soakedit.setValidator(QRegExpValidator(regextime,self)) setButton = QPushButton(QApplication.translate("Button","Set",None)) setButton.clicked.connect(self.setsegment) setButton.setFocusPolicy(Qt.NoFocus) #add widgets to the table self.segmenttable.setCellWidget(i,0,svedit) self.segmenttable.setCellWidget(i,1,rampedit) self.segmenttable.setCellWidget(i,2,soakedit) self.segmenttable.setCellWidget(i,3,setButton) #idn = id number, sv = float set value, ramp = ramp value, soak = soak value
Example #16
Source File: console.py From bluesky with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(Stackwin, self).__init__(parent) Console.stackText = self self.setFocusPolicy(Qt.NoFocus)
Example #17
Source File: console.py From bluesky with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(Cmdline, self).__init__(parent) Console.lineEdit = self self.cmdline = '' # self.setFocusPolicy(Qt.NoFocus) self.set_cmdline('')
Example #18
Source File: QSlider.py From python with Apache License 2.0 | 5 votes |
def initUI(self): sld = QSlider(Qt.Horizontal, self) sld.setFocusPolicy(Qt.NoFocus) # 这个有什么作用? sld.setGeometry(30, 40, 100, 30) sld.valueChanged[int].connect(self.changeValue) self.label = QLabel(self) self.label.setPixmap(QPixmap('mute.png')) self.label.setGeometry(160, 40, 80, 30) self.setGeometry(300, 300, 280, 170) self.setWindowTitle('QSlider') self.show()
Example #19
Source File: move.py From lanzou-gui with MIT License | 5 votes |
def initUI(self): self.setWindowTitle("移动文件(夹)") self.setWindowIcon(QIcon(SRC_DIR + "move.ico")) self.lb_name = QLabel() self.lb_name.setText("文件(夹)名:") self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_name = AutoResizingTextEdit() self.tx_name.setFocusPolicy(Qt.NoFocus) # 只读 self.tx_name.setReadOnly(True) self.lb_new_path = QLabel() self.lb_new_path.setText("目标文件夹:") self.lb_new_path.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_new_path = QComboBox() self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.button(QDialogButtonBox.Ok).setText("确定") self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_name, 1, 0) self.grid.addWidget(self.tx_name, 1, 1) self.grid.addWidget(self.lb_new_path, 2, 0) self.grid.addWidget(self.tx_new_path, 2, 1) self.grid.addWidget(self.buttonBox, 3, 0, 1, 2) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.setMinimumWidth(280)
Example #20
Source File: setpwd.py From lanzou-gui with MIT License | 5 votes |
def initUI(self): self.setWindowTitle("请稍等……") self.setWindowIcon(QIcon(SRC_DIR + "password.ico")) self.lb_oldpwd = QLabel() self.lb_oldpwd.setText("当前提取码:") self.lb_oldpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_oldpwd = QLineEdit() # 当前提取码 只读 self.tx_oldpwd.setFocusPolicy(Qt.NoFocus) self.tx_oldpwd.setReadOnly(True) self.lb_newpwd = QLabel() self.lb_newpwd.setText("新的提取码:") self.lb_newpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) self.tx_newpwd = QLineEdit() self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonBox.button(QDialogButtonBox.Ok).setText("确定") self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消") self.grid = QGridLayout() self.grid.setSpacing(10) self.grid.addWidget(self.lb_oldpwd, 1, 0) self.grid.addWidget(self.tx_oldpwd, 1, 1) self.grid.addWidget(self.lb_newpwd, 2, 0) self.grid.addWidget(self.tx_newpwd, 2, 1) self.grid.addWidget(self.buttonBox, 3, 0, 1, 2) self.setLayout(self.grid) self.buttonBox.accepted.connect(self.btn_ok) self.buttonBox.accepted.connect(self.accept) self.buttonBox.accepted.connect(self.set_tip) self.buttonBox.rejected.connect(self.reject) self.buttonBox.rejected.connect(self.set_tip) self.setMinimumWidth(280)
Example #21
Source File: control_buttons.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def newButton(self, icon): button = QIconPushButton(self) button.setFocusPolicy(Qt.NoFocus) button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) button.setIcon(icon) button.setIconSize(QSize(32, 32)) return button
Example #22
Source File: control_buttons.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def newButton(self, icon): button = QIconPushButton(self) button.setFocusPolicy(Qt.NoFocus) button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding) button.setIcon(icon) button.setIconSize(QSize(32, 32)) return button
Example #23
Source File: roast_properties.py From artisan with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent = None, aw = None, tarePopup = None): super(tareDlg,self).__init__(parent, aw) self.parent = parent self.tarePopup = tarePopup self.setModal(True) self.setWindowTitle(QApplication.translate("Form Caption","Tare Setup", None)) self.taretable = QTableWidget() self.taretable.setTabKeyNavigation(True) self.createTareTable() self.taretable.itemSelectionChanged.connect(self.selectionChanged) addButton = QPushButton(QApplication.translate("Button","Add", None)) addButton.setFocusPolicy(Qt.NoFocus) self.delButton = QPushButton(QApplication.translate("Button","Delete", None)) self.delButton.setDisabled(True) self.delButton.setFocusPolicy(Qt.NoFocus) addButton.clicked.connect(self.addTare) self.delButton.clicked.connect(self.delTare) okButton = QPushButton(QApplication.translate("Button","OK", None)) cancelButton = QPushButton(QApplication.translate("Button","Cancel",None)) cancelButton.setFocusPolicy(Qt.NoFocus) okButton.clicked.connect(self.close) cancelButton.clicked.connect(self.reject) contentbuttonLayout = QHBoxLayout() contentbuttonLayout.addStretch() contentbuttonLayout.addWidget(addButton) contentbuttonLayout.addWidget(self.delButton) contentbuttonLayout.addStretch() buttonLayout = QHBoxLayout() buttonLayout.addStretch() buttonLayout.addWidget(cancelButton) buttonLayout.addWidget(okButton) layout = QVBoxLayout() layout.addWidget(self.taretable) layout.addLayout(contentbuttonLayout) layout.addLayout(buttonLayout) self.setLayout(layout)
Example #24
Source File: sampling.py From artisan with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent = None, aw = None): super(SamplingDlg,self).__init__(parent, aw) self.setWindowTitle(QApplication.translate("Message","Sampling", None)) self.setModal(True) self.org_delay = self.aw.qmc.delay self.org_flagKeepON = self.aw.qmc.flagKeepON self.org_flagOpenCompleted = self.aw.qmc.flagOpenCompleted self.keepOnFlag = QCheckBox(QApplication.translate("Label","Keep ON", None)) self.keepOnFlag.setFocusPolicy(Qt.NoFocus) self.keepOnFlag.setChecked(bool(self.aw.qmc.flagKeepON)) self.openCompletedFlag = QCheckBox(QApplication.translate("Label","Open Completed Roast in Viewer", None)) self.openCompletedFlag.setFocusPolicy(Qt.NoFocus) self.openCompletedFlag.setChecked(bool(self.aw.qmc.flagOpenCompleted)) self.interval = QDoubleSpinBox() self.interval.setSingleStep(1) self.interval.setValue(self.aw.qmc.delay/1000.) self.interval.setRange(self.aw.qmc.min_delay/1000.,40.) self.interval.setDecimals(1) self.interval.setAlignment(Qt.AlignRight) self.interval.setSuffix("s") intervalLayout = QHBoxLayout() intervalLayout.addStretch() intervalLayout.addWidget(self.interval) intervalLayout.addStretch() # connect the ArtisanDialog standard OK/Cancel buttons self.dialogbuttons.accepted.connect(self.ok) self.dialogbuttons.rejected.connect(self.close) flagGrid = QGridLayout() flagGrid.addWidget(self.keepOnFlag,0,0) flagGrid.addWidget(self.openCompletedFlag,1,0) flagLayout = QHBoxLayout() flagLayout.addStretch() flagLayout.addLayout(flagGrid) flagLayout.addStretch() buttonsLayout = QHBoxLayout() buttonsLayout.addStretch() buttonsLayout.addWidget(self.dialogbuttons) #incorporate layouts layout = QVBoxLayout() layout.addLayout(intervalLayout) layout.addLayout(flagLayout) layout.addStretch() layout.addLayout(buttonsLayout) self.setLayout(layout) self.dialogbuttons.button(QDialogButtonBox.Ok).setFocus() settings = QSettings() if settings.contains("SamplingPosition"): self.move(settings.value("SamplingPosition")) layout.setSizeConstraint(QLayout.SetFixedSize)
Example #25
Source File: rename.py From lanzou-gui with MIT License | 4 votes |
def update_text(self): num= len(self.infos) if num == 1: self.lb_name.setVisible(True) self.tx_name.setVisible(True) infos = self.infos[0] self.buttonBox.button(QDialogButtonBox.Ok).setToolTip("") # 去除新建文件夹影响 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) # 去除新建文件夹影响 self.setWindowTitle("修改文件夹名与描述") self.tx_name.setText(str(infos.name)) if infos.desc: self.tx_desc.setText(str(infos.desc)) self.tx_desc.setToolTip('原描述:' + str(infos.desc)) else: self.tx_desc.setText("无") self.tx_desc.setToolTip('') self.tx_desc.setPlaceholderText("无") self.min_width = len(str(infos.name)) * 8 if infos.is_file: self.setWindowTitle("修改文件描述") self.tx_name.setFocusPolicy(Qt.NoFocus) self.tx_name.setReadOnly(True) else: self.tx_name.setFocusPolicy(Qt.StrongFocus) self.tx_name.setReadOnly(False) elif num > 1: self.lb_name.setVisible(False) self.tx_name.setVisible(False) self.setWindowTitle(f"批量修改{num}个文件(夹)的描述") self.tx_desc.setText('') self.tx_desc.setPlaceholderText("建议160字数以内。") else: self.setWindowTitle("新建文件夹") self.tx_name.setText("") self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Ok).setToolTip("请先输入文件名!") self.tx_name.textChanged.connect(self.slot_new_ok_btn) self.tx_name.setPlaceholderText("不支持空格,如有会被自动替换成 _") self.tx_name.setFocusPolicy(Qt.StrongFocus) self.tx_name.setReadOnly(False) self.tx_desc.setPlaceholderText("可选项,建议160字数以内。") if self.min_width < 400: self.min_width = 400 self.resize(self.min_width, 200)