本文整理汇总了Python中PyQt4.Qt.QTableView.selectRow方法的典型用法代码示例。如果您正苦于以下问题:Python QTableView.selectRow方法的具体用法?Python QTableView.selectRow怎么用?Python QTableView.selectRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTableView
的用法示例。
在下文中一共展示了QTableView.selectRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PluginUpdaterDialog
# 需要导入模块: from PyQt4.Qt import QTableView [as 别名]
# 或者: from PyQt4.Qt.QTableView import selectRow [as 别名]
#.........这里部分代码省略.........
self.forum_link = display_plugin.forum_link
self.zip_url = display_plugin.zip_url
self.forum_action.setEnabled(bool(self.forum_link))
self.install_button.setEnabled(display_plugin.is_valid_to_install())
self.install_action.setEnabled(self.install_button.isEnabled())
self.uninstall_action.setEnabled(display_plugin.is_installed())
self.history_action.setEnabled(display_plugin.has_changelog)
self.configure_button.setEnabled(display_plugin.is_installed())
self.configure_action.setEnabled(self.configure_button.isEnabled())
self.toggle_enabled_action.setEnabled(display_plugin.is_installed())
self.donate_enabled_action.setEnabled(bool(display_plugin.donation_link))
else:
self.description.setText('')
self.forum_link = None
self.zip_url = None
self.forum_action.setEnabled(False)
self.install_button.setEnabled(False)
self.install_action.setEnabled(False)
self.uninstall_action.setEnabled(False)
self.history_action.setEnabled(False)
self.configure_button.setEnabled(False)
self.configure_action.setEnabled(False)
self.toggle_enabled_action.setEnabled(False)
self.donate_enabled_action.setEnabled(False)
self.update_forum_label()
def _donate_clicked(self):
plugin = self._selected_display_plugin()
if plugin and plugin.donation_link:
open_url(QUrl(plugin.donation_link))
def _select_and_focus_view(self, change_selection=True):
if change_selection and self.plugin_view.model().rowCount() > 0:
self.plugin_view.selectRow(0)
else:
idx = self.plugin_view.selectionModel().currentIndex()
self._plugin_current_changed(idx, 0)
self.plugin_view.setFocus()
def _filter_combo_changed(self, idx):
self.filter_by_name_lineedit.setText("") # clear the name filter text when a different group was selected
self.proxy_model.set_filter_criteria(idx)
if idx == FILTER_NOT_INSTALLED:
self.plugin_view.sortByColumn(5, Qt.DescendingOrder)
else:
self.plugin_view.sortByColumn(0, Qt.AscendingOrder)
self._select_and_focus_view()
def _filter_name_lineedit_changed(self, text):
self.proxy_model.set_filter_text(text) # set the filter text for filterAcceptsRow
def _forum_label_activated(self):
if self.forum_link:
open_url(QUrl(self.forum_link))
def _selected_display_plugin(self):
idx = self.plugin_view.selectionModel().currentIndex()
actual_idx = self.proxy_model.mapToSource(idx)
return self.model.display_plugins[actual_idx.row()]
def _uninstall_plugin(self, name_to_remove):
if DEBUG:
prints('Removing plugin: ', name_to_remove)
remove_plugin(name_to_remove)
# Make sure that any other plugins that required this plugin
# to be uninstalled first have the requirement removed
示例2: MainWidget
# 需要导入模块: from PyQt4.Qt import QTableView [as 别名]
# 或者: from PyQt4.Qt.QTableView import selectRow [as 别名]
#.........这里部分代码省略.........
self.timer.timeout.disconnect(self.updateFreq)
self.ZMatModel.dataChanged.connect(self.clearUpdateView)
self.clearUpdateView()
def gausclicked(self, item, point):
itemdata = item.scatter.data
points = [ row[7] for row in itemdata ]
idx = points.index(point[0])
for i in range(3):
if i == 0:
x = [idx]
y = [self.scfenergies[idx]]
else:
x = [idx, idx]
y = [self.geovalues[2*i-2][idx], self.geovalues[2*i-1][idx]]
plot = self.gaussianPlot.getItem(1, i+1)
plot.removeItem(plot.highlight)
plot.highlight=plot.plot(x, y, symbol='o', symbolPen='w', symbolBrush=None, pen=None, symbolSize=15, pxMode=True, antialias=True, autoDownsample=False)
self.ZMatModel.dataChanged.disconnect(self.clearUpdateView)
self.inp = []
self.populateZMatModel()
self.inp = xyz2zmat(self.atomcoords[min(idx, len(self.atomcoords)-1)], self.atomsymbols)
self.populateZMatModel()
self.ZMatModel.dataChanged.connect(self.clearUpdateView)
self.updateView()
def highlight(self, obj, itms):
for itm in itms:
idx = next((i for i, sublist in enumerate(self.atomList) if itm in sublist), -1)
#print(idx)
if idx != -1:
addAtom(obj, idx, r, vs, c, opt='highlight', fast=self.fast)
self.highList.append([idx, obj.items[-1]])
self.ZMatTable.selectRow(idx)
idx = next((i for i, sublist in enumerate(self.highList) if itm in sublist), -1)
if idx != -1:
obj.removeItem(self.highList[idx][1])
self.highList.pop(idx)
self.ZMatTable.clearSelection()
self.statusBar.clearMessage()
if len(self.highList) > 0:
idxs = np.asarray(self.highList).T[0]
selected = []
for i in idxs:
selected.append(str(i+1)+str(elements[elems[i]]))
self.statusBar.showMessage('Selected atoms: '+str(selected), 5000)
def buildB(self):
try:
nelems
except NameError:
self.build()
else:
if len(self.highList) <= min(nelems, 3):
diff = min(nelems, 3) - len(self.highList)
if diff != 0:
self.statusBar.clearMessage()
self.statusBar.showMessage('Please select '+str(diff)+' more atom(s).')
else:
self.build()
else:
self.statusBar.clearMessage()
self.statusBar.showMessage('Too many atoms selected.')
def build(self):
selection = self.periodicTable()
示例3: PluginUpdaterDialog
# 需要导入模块: from PyQt4.Qt import QTableView [as 别名]
# 或者: from PyQt4.Qt.QTableView import selectRow [as 别名]
#.........这里部分代码省略.........
actual_idx = self.proxy_model.mapToSource(current)
display_plugin = self.model.display_plugins[actual_idx.row()]
self.description.setText(display_plugin.description)
self.forum_link = display_plugin.forum_link
self.forum_action.setEnabled(bool(self.forum_link))
self.install_button.setEnabled(display_plugin.is_valid_to_install())
self.install_action.setEnabled(self.install_button.isEnabled())
self.uninstall_action.setEnabled(display_plugin.is_installed())
self.history_action.setEnabled(display_plugin.has_changelog)
self.configure_button.setEnabled(display_plugin.is_installed())
self.configure_action.setEnabled(self.configure_button.isEnabled())
self.toggle_enabled_action.setEnabled(display_plugin.is_installed())
self.donate_enabled_action.setEnabled(bool(display_plugin.donation_link))
else:
self.description.setText("")
self.forum_link = None
self.forum_action.setEnabled(False)
self.install_button.setEnabled(False)
self.install_action.setEnabled(False)
self.uninstall_action.setEnabled(False)
self.history_action.setEnabled(False)
self.configure_button.setEnabled(False)
self.configure_action.setEnabled(False)
self.toggle_enabled_action.setEnabled(False)
self.donate_enabled_action.setEnabled(False)
def _donate_clicked(self):
plugin = self._selected_display_plugin()
if plugin and plugin.donation_link:
open_url(QUrl(plugin.donation_link))
def _select_and_focus_view(self, change_selection=True):
if change_selection and self.plugin_view.model().rowCount() > 0:
self.plugin_view.selectRow(0)
else:
idx = self.plugin_view.selectionModel().currentIndex()
self._plugin_current_changed(idx, 0)
self.plugin_view.setFocus()
def _filter_combo_changed(self, idx):
self.proxy_model.set_filter_criteria(idx)
if idx == FILTER_NOT_INSTALLED:
self.plugin_view.sortByColumn(5, Qt.DescendingOrder)
else:
self.plugin_view.sortByColumn(0, Qt.AscendingOrder)
self._select_and_focus_view()
def _forum_label_activated(self):
if self.forum_link:
open_url(QUrl(self.forum_link))
def _selected_display_plugin(self):
idx = self.plugin_view.selectionModel().currentIndex()
actual_idx = self.proxy_model.mapToSource(idx)
return self.model.display_plugins[actual_idx.row()]
def _uninstall_plugin(self, name_to_remove):
if DEBUG:
prints("Removing plugin: ", name_to_remove)
remove_plugin(name_to_remove)
# Make sure that any other plugins that required this plugin
# to be uninstalled first have the requirement removed
for display_plugin in self.model.display_plugins:
# Make sure we update the status and display of the
# plugin we just uninstalled
if name_to_remove in display_plugin.uninstall_plugins: