本文整理汇总了Python中PyQt5.QtGui.QStandardItem.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Python QStandardItem.setEditable方法的具体用法?Python QStandardItem.setEditable怎么用?Python QStandardItem.setEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QStandardItem
的用法示例。
在下文中一共展示了QStandardItem.setEditable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addPoint
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def addPoint(self):
rows = self._current.editor.selectedRows()
newStart = self._videoWidget.position
if len(rows) == 0 or newStart is None:
self._err.showMessage(_("Select a subtitle and position in current video first."))
return
# row and sub reflect the same subtitle, but we need both for different things
row = rows[0]
sub = self._current.data.subtitles[row]
# Don't add the same subtitle or the same sync time twice
if any(row == point.subNo or newStart == point.start
for point in _syncPoints(self._current.model)):
self._err.showMessage(_("Can't repeat synchronization points"))
return
if sub.fps != newStart.fps:
self._err.showMessage(_("Subtitle and video have different framerates (%(sub)s vs"
"%(vid)s") % dict(sub=sub.fps, vid=newStart.fps))
return
delta = sub.end - sub.start
newEnd = newStart + delta
startItem, endItem, textItem = createRow(sub, newStart, newEnd)
subNoItem = QStandardItem(str(row))
subNoItem.setEditable(False)
textItem.setEditable(False)
rmItem = QStandardItem("")
self._current.model.appendRow([subNoItem, startItem, endItem, textItem, rmItem])
self._rmButton(self._table, rmItem)
示例2: scanPath
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def scanPath(self):
path=self.path
sbpCheck=self.subPathCheck.checkState()==2
listdir=[]
if sbpCheck:
[[listdir.append(p.replace(path+os.sep,"")+os.sep+x if p.replace(path,"")!="" else x) for x in f] for (p,d,f) in os.walk(path)]
else:
listdir=os.listdir(path)
#print(listdir)
iconDict={"doc":QIcon("icons\\doc.png"),"docx":QIcon("icons\\docx.png")}
model=self.FilesTableModel
model.clear()
self.FilesList.clear()
for x in listdir:
filepath=self.path+os.sep+x
if not os.path.exists(filepath) or os.path.isdir(filepath): continue
attrs=win32api.GetFileAttributes(filepath)
#print(p,x, attrs, win32con.FILE_ATTRIBUTE_HIDDEN) Исключаем все скрытые файлы
if attrs in [2,3,34,35]: continue#win32con.FILE_ATTRIBUTE_HIDDEN=2,arch=32,readonly=1
keyIcon=x.split(".")[-1]
if keyIcon in iconDict.keys():
item=QStandardItem(iconDict[keyIcon],x)
item.setCheckable(True)
item.setCheckState(2)
item.setEditable(False)
model.appendRow(item)
self.ChangeFilesList()
示例3: __connect_events
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def __connect_events(self):
self.model = QStandardItemModel()
self.mass_list = []
for i in range(10):
mass = 184 + i
self.mass_list.append(str(mass))
for i in range(10):
mass = 209 + i
self.mass_list.append(str(mass))
for i in range(10):
mass = 273.3 + i
self.mass_list.append(str(mass))
for i in range(10):
mass = 294 + i
self.mass_list.append(str(mass))
for mass in self.mass_list:
item = QStandardItem(mass)
item.setCheckable(True)
item.setEditable(True)
self.model.appendRow(item)
self.view = self.ui.listView_Mass
self.view.setModel(self.model)
# changes in one item, don't know which one
self.model.itemChanged.connect(self.change_list)
# changes in button
self.ui.pushButton_ChangeList.clicked.connect(self.emit_list_signal)
# get peaks found and update automatically the mass list
self.ana.masstabSelectorRaisedSignal.connect(self.update_list_view)
示例4: _set_items
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def _set_items(self, item, data):
item.setRowCount(0)
subitems = []
for d in sorted(data, key=lambda r: r.name.lower()):
subitem = QStandardItem(d.name)
subitem.setEditable(False)
subitem.setData(d, Qt.UserRole)
subitems.append(subitem)
item.appendRows(subitems)
示例5: fresh
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def fresh(self):
confFile=open("conf","r")
self.listModel=QStandardItemModel()
self.itemList=cPickle.load(confFile)
confFile.close()
for item in self.itemList:
itemView=QStandardItem(QIcon(item.path),item.name)
itemView.setEditable(False)
self.listModel.appendRow(itemView)
self.listview.setModel(self.listModel)
示例6: build_row
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def build_row(result):
preview = QStandardItem(str(result.data))
preview.setEditable(False)
preview.result = result
return [
QStandardItem(result.manifest.label),
QStandardItem(result.manifest._size),
QStandardItem(result.manifest.type()),
preview,
]
示例7: load_projects
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def load_projects(self):
self.clear()
self.setHorizontalHeaderLabels(['Name'])
for project in get_projects():
item = QStandardItem(project)
item.setEditable(False)
self.appendRow(item)
self.sort(0)
示例8: fillUserList
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def fillUserList(newUser=None):
model = QStandardItemModel()
mylist = ['asd', 'wqe', 'wqra', 'tewt4']
if newUser:
mylist += newUser
print(mylist)
for item in mylist:
myitem = QStandardItem(item)
myitem.setEditable(0)
model.appendRow(myitem)
myapp.listView.setModel(model)
myapp.listView.doubleClicked.connect(openConversationWindow)
示例9: get_script_structure
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def get_script_structure(self):
"""Scanning dispatcher"""
self.logger.debug("Scan script structure recursively")
# first, find all product properties in every script and return a set
for i in range(len(self.scripts)):
scriptname = self.scripts[i]
if scriptname != "":
item = QStandardItem(QIcon(':/images/smallIcons_1712.ico'), self.scriptheader[i] + ": " + scriptname)
item.setEditable(False)
item2 = QStandardItem(scriptname)
item2.setEditable(False)
ScriptTree.model.appendRow([item, item2])
ScriptTree.root.children.append(ScriptNode(scriptname + "(" + self.scriptheader[i] + ")", []))
self._scan_script(scriptname, ScriptTree.root.children[len(ScriptTree.root.children) - 1], 0, item)
ScriptTree.model.setHeaderData(0, QtCore.Qt.Horizontal, translate('ScriptTree', 'Script structure'))
示例10: update_list_view
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def update_list_view(self, xind):
self.mass_list = []
for i in range(len(xind)):
m = "{:.1f}".format(float(xind[i]))
self.mass_list.append(str(m))
self.model.clear()
self.model = QStandardItemModel()
for mass in self.mass_list:
item = QStandardItem(mass)
item.setCheckable(True)
item.setEditable(True)
item.setCheckState(Qt.Checked)
self.model.appendRow(item)
self.view = self.ui.listView_Mass
self.view.setModel(self.model)
# changes in one item, don't know which one
self.model.itemChanged.connect(self.change_list)
示例11: addRow
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def addRow(self,arg=None,FindRepl=["",""]):
#print(arg,FindRepl)
row=self.replaceTable.currentIndex().row()
ToolTipText=["Текст для поиска","Текст замены",
"Использовать индивидуальные настройки для данной строки"]
items=[]
for i, TText in enumerate(ToolTipText):
Item=QStandardItem()
Item.setData(TText,Qt.ToolTipRole)
if i>1:
Item.setData(False,Qt.CheckStateRole)
Item.setData("Задать",Qt.DisplayRole)
Item.setData(self.optionWdgt,Qt.UserRole)
Item.setEditable(False)
Item.setCheckable(True)
else:
Item.setData(FindRepl[i],Qt.DisplayRole)
items.append(Item)
self.ReplaceModel.insertRow(row+1,items)
self.replaceTable.selectRow(row+1)
self.replaceTable.resizeRowsToContents()
示例12: fill_tree
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def fill_tree(self, children: List[FsFileInfo]) -> None:
self.item.removeRows(0, self.item.rowCount())
for child in self.tree.sort_children(children):
subitem = QStandardItem(child.get_label())
if child.checkable():
subitem.setCheckable(True)
subitem.setCheckState(True)
subitem.setTristate(True)
subitem.setCheckState(child.state)
subitem.setEnabled(child.enable())
subitem.setSelectable(child.selectable())
subitem.setEditable(False)
subitem.setData(QVariant(child), Qt.UserRole)
if child.folderish():
# Add "Loading..." entry in advance for when the user
# will click to expand it.
loaditem = QStandardItem(Translator.get("LOADING"))
loaditem.setSelectable(False)
subitem.appendRow(loaditem)
self.item.appendRow(subitem)
示例13: UniverseTreeView
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
class UniverseTreeView(QTreeView):
def __init__(self, parent=None):
super(UniverseTreeView, self).__init__(parent)
model = QStandardItemModel()
self.setModel(model)
root_item = model.invisibleRootItem()
self.characters_item = QStandardItem("Characters")
self.characters_item.setEditable(False)
self.races_item = QStandardItem("Races")
self.races_item.setEditable(False)
self.skills_item = QStandardItem("Skills")
self.skills_item.setEditable(False)
self.personalities_item = QStandardItem("Personalities")
self.personalities_item.setEditable(False)
root_item.appendRow(self.characters_item)
root_item.appendRow(self.races_item)
root_item.appendRow(self.skills_item)
root_item.appendRow(self.personalities_item)
self.init_all()
GlobalData.character_added.connect(self.init_characters)
GlobalData.character_removed.connect(self.init_characters)
GlobalData.characters_reset.connect(self.init_characters)
GlobalData.race_added.connect(self.init_races)
GlobalData.race_removed.connect(self.init_races)
GlobalData.races_reset.connect(self.init_races)
GlobalData.skill_added.connect(self.init_skills)
GlobalData.skill_removed.connect(self.init_skills)
GlobalData.skills_reset.connect(self.init_skills)
GlobalData.personality_added.connect(self.init_personalities)
GlobalData.personality_removed.connect(self.init_personalities)
GlobalData.personalities_reset.connect(self.init_personalities)
self.activated.connect(self.item_activated)
def init_all(self):
self.init_characters()
self.init_races()
self.init_skills()
self.init_personalities()
def _set_items(self, item, data):
item.setRowCount(0)
subitems = []
for d in sorted(data, key=lambda r: r.name.lower()):
subitem = QStandardItem(d.name)
subitem.setEditable(False)
subitem.setData(d, Qt.UserRole)
subitems.append(subitem)
item.appendRows(subitems)
def init_characters(self):
self._set_items(self.characters_item, GlobalData.characters)
def init_races(self):
self._set_items(self.races_item, GlobalData.races)
def init_skills(self):
self._set_items(self.skills_item, GlobalData.skills)
def init_personalities(self):
self._set_items(self.personalities_item, GlobalData.personalities)
def item_activated(self, index):
item = index.data(Qt.UserRole)
mdiArea = __main__.main_window.mdiArea
if isinstance(item, Race):
windows = mdiArea.subWindowList()
for window in windows:
widget = window.widget()
if isinstance(widget, ViewRaceWidget) and widget.race is item:
mdiArea.setActiveSubWindow(window)
break
else:
widget = ViewRaceWidget(item)
window = mdiArea.addSubWindow(widget)
item.removed.connect(window.close)
window.show()
elif isinstance(item, Character):
print("character")
elif isinstance(item, Skill):
print("skill")
elif isinstance(item, Personality):
print("personality")
#.........这里部分代码省略.........
示例14: create_new_list_item
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def create_new_list_item(text):
item = QStandardItem()
item.setText(text)
item.setCheckable(True)
item.setEditable(False)
return item
示例15: setContents
# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setEditable [as 别名]
def setContents(self, linkList):
self.resultListModel.clear()
for item in linkList:
resultItem = QStandardItem(item)
resultItem.setEditable(False)
self.resultListModel.appendRow(resultItem)