本文整理汇总了Python中PySide.QtGui.QIcon.fromTheme方法的典型用法代码示例。如果您正苦于以下问题:Python QIcon.fromTheme方法的具体用法?Python QIcon.fromTheme怎么用?Python QIcon.fromTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QIcon
的用法示例。
在下文中一共展示了QIcon.fromTheme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def __init__(self, app, *args, **kwargs):
QDialog.__init__(self, *args, **kwargs)
self.app = app
self.closed = False
self.sort_order = None
self.ui = Ui_List()
self.ui.setupUi(self)
self.setWindowIcon(get_icon())
self.notebooksModel = QStandardItemModel()
self.ui.notebooksList.setModel(self.notebooksModel)
self.ui.notebooksList.selection.connect(self.selection_changed)
self.ui.notebooksList.setContextMenuPolicy(Qt.CustomContextMenu)
self.ui.notebooksList.customContextMenuRequested.connect(self.notebook_context_menu)
self.notesModel = QStandardItemModel()
self.notesModel.setHorizontalHeaderLabels(
[self.tr('Title'), self.tr('Last Updated')])
self.ui.notesList.setModel(self.notesModel)
self.ui.notesList.doubleClicked.connect(self.note_dblclicked)
self.ui.notesList.setContextMenuPolicy(Qt.CustomContextMenu)
self.ui.notesList.customContextMenuRequested.connect(self.note_context_menu)
self.ui.notesList.header().sortIndicatorChanged.connect(self.sort_order_updated)
self.ui.newNotebookBtn.setIcon(QIcon.fromTheme('folder-new'))
self.ui.newNotebookBtn.clicked.connect(self.new_notebook)
self.ui.newNoteBtn.setIcon(QIcon.fromTheme('document-new'))
self.ui.newNoteBtn.clicked.connect(self.new_note)
self.ui.newNoteBtn.setShortcut(QKeySequence(self.tr('Ctrl+n')))
self.ui.newNotebookBtn.setShortcut(QKeySequence(self.tr('Ctrl+Shift+n')))
QShortcut(QKeySequence(self.tr('Ctrl+q')), self, self.close)
示例2: get_tray_icon
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def get_tray_icon(is_black=False):
if os.environ.get('DESKTOP_SESSION', 'default') == 'gnome':
return QIcon.fromTheme('everpad', QIcon('../../data/everpad.png'))
if is_black:
return QIcon.fromTheme('everpad-black', QIcon('../../data/everpad-black.png'))
else:
return QIcon.fromTheme('everpad-mono', QIcon('../../data/everpad-mono.png'))
示例3: _reload_notebooks_list
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def _reload_notebooks_list(self, select_notebook_id=None):
# TODO could enable selecting an already selected stack
self.notebooksModel.clear()
root = QStandardItem(QIcon.fromTheme('user-home'), self.tr('All Notes'))
self.notebooksModel.appendRow(root)
selected_item = root
stacks = {}
for notebook_struct in self.app.provider.list_notebooks():
notebook = Notebook.from_tuple(notebook_struct)
count = self.app.provider.get_notebook_notes_count(notebook.id)
item = QNotebookItem(notebook, count)
if(notebook.stack == ''):
root.appendRow(item)
else:
if(notebook.stack not in stacks.keys()):
stack = QStandardItem(QIcon.fromTheme('user-home'), notebook.stack)
stack.stack = notebook.stack
root.appendRow(stack)
stacks[notebook.stack] = stack
stacks[notebook.stack].appendRow(item)
if select_notebook_id and notebook.id == select_notebook_id:
selected_item = item
self.ui.notebooksList.expandAll()
if selected_item and not select_notebook_id == SELECT_NONE:
index = self.notebooksModel.indexFromItem(selected_item)
self.ui.notebooksList.setCurrentIndex(index)
self.notebook_selected(index)
示例4: run
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def run(self):
mw = self.mw
if mw.google_radio.isChecked():
mw.setStatusTip("Loading...")
mw.start_button.setText("Loading...")
mw.setEnabled(False)
try:
streetdb = table2dbf.load_from_google(mw.username.text(), mw.password.text(), mw.document_id.text())
except:
import traceback
traceback.print_exc()
self.mbox = ("Google-Fail", QMessageBox.Warning, QIcon.fromTheme("dialog-warning"),
"Couldn't login or load data from google!", None)
return
else:
streetdb = table2dbf.load_street_db(mw.csv_file.text())
mw.setStatusTip("Updating...")
mw.start_button.setText("Updating...")
try:
table = dbf.Table(mw.dbf_file.text())
table.open()
self.updates = table2dbf.update_table(table, streetdb)
table.close()
except dbf.DbfError as e:
self.mbox = ("DB-Fail", QMessageBox.Warning, QIcon.fromTheme("dialog-warning"),
"Couldn't open/update table!", e.message)
return
self.streetdb = streetdb
if mw.split_check.checkState():
import split_dbf
split_dbf.split_files(mw.dbf_file.text())
示例5: notebook_context_menu
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def notebook_context_menu(self, pos):
index = self.ui.notebooksList.currentIndex()
item = self.notebooksModel.itemFromIndex(index)
if hasattr(item, 'notebook'):
menu = QMenu(self.ui.notebooksList)
menu.addAction(QIcon.fromTheme('gtk-edit'), self.tr('Rename'), self.rename_notebook)
menu.addAction(QIcon.fromTheme('gtk-delete'), self.tr('Remove'), self.remove_notebook)
menu.exec_(self.ui.notebooksList.mapToGlobal(pos))
示例6: init_toolbar
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def init_toolbar(self):
self.save_btn = self.ui.toolBar.addAction(QIcon.fromTheme("document-save"), self.tr("Save"), self.save)
self.close_btn = self.ui.toolBar.addAction(
QIcon.fromTheme("window-close"), self.tr("Close without saving"), self.close
)
self.ui.toolBar.addAction(QIcon.fromTheme("edit-delete"), self.tr("Remove note"), self.delete)
self.print_btn = self.ui.toolBar.addAction(
QIcon.fromTheme("document-print"), self.tr("Print note"), self.note_edit.print_
)
self.email_btn = self.ui.toolBar.addAction(
QIcon.fromTheme("mail-unread"), self.tr("Email note"), self.note_edit.email_note
)
self.email_btn = self.ui.toolBar.addAction(
QIcon.fromTheme("emblem-shared"), self.tr("Share note"), self.share_note
)
self.ui.toolBar.addSeparator()
for action in self.note_edit.get_format_actions():
self.ui.toolBar.addAction(action)
self.ui.toolBar.addSeparator()
self.find_action = QAction(QIcon.fromTheme("edit-find"), self.tr("Find"), self)
self.find_action.setCheckable(True)
self.find_action.triggered.connect(self.findbar.toggle_visible)
self.ui.toolBar.addAction(self.find_action)
self.ui.toolBar.addSeparator()
self.pin = self.ui.toolBar.addAction(
QIcon.fromTheme("edit-pin", QIcon.fromTheme("everpad-pin")), self.tr("Pin note"), self.mark_touched
)
self.pin.setCheckable(True)
self.pin.setChecked(self.note.pinnded)
示例7: _get_icon
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def _get_icon(self, icons):
"""Get icon"""
if len(icons):
icon, other = icons[0], icons[1:]
fallback = self._get_icon(other)
if fallback:
return QIcon.fromTheme(icon, fallback=fallback)
else:
return QIcon.fromTheme(icon)
else:
return None
示例8: _init_interface
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def _init_interface(self):
self.ui = Ui_List()
self.ui.setupUi(self)
self.setWindowIcon(get_icon())
self.setWindowTitle(self.tr("Everpad / All Notes"))
self.ui.newNotebookBtn.setIcon(QIcon.fromTheme('folder-new'))
self.ui.newNotebookBtn.clicked.connect(self.new_notebook)
self.ui.newNoteBtn.setIcon(QIcon.fromTheme('document-new'))
self.ui.newNoteBtn.clicked.connect(self.new_note)
self.ui.newNoteBtn.setShortcut(QKeySequence(self.tr('Ctrl+n')))
self.ui.newNotebookBtn.setShortcut(QKeySequence(self.tr('Ctrl+Shift+n')))
QShortcut(QKeySequence(self.tr('Ctrl+q')), self, self.close)
示例9: init_toolbar
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def init_toolbar(self):
self.save_btn = self.ui.toolBar.addAction(QIcon.fromTheme("document-save"), self.tr("Save"), self.save)
self.ui.toolBar.addAction(QIcon.fromTheme("cancel"), self.tr("Close without saving"), self.close)
self.ui.toolBar.addAction(QIcon.fromTheme("edit-delete"), self.tr("Remove note"), self.delete)
self.ui.toolBar.addSeparator()
for action in self.note_edit.get_format_actions():
self.ui.toolBar.addAction(action)
self.ui.toolBar.addSeparator()
self.ui.toolBar.addAction(QIcon.fromTheme("add"), self.tr("Attache file"), self.resource_edit.add)
self.ui.toolBar.addSeparator()
self.options = self.ui.toolBar.addAction(
QIcon.fromTheme("gtk-properties"), self.tr("Options"), self.show_options
)
self.options.setCheckable(True)
示例10: setupActions
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def setupActions(self):
action_slots = dict(
New=self.newFile, Open=self.askOpenFile, Save=self.saveFile,
SaveAs=self.askSaveFile, Print=self.askPrint, Quit=self.close,
Undo=self.editor.undo, Redo=self.editor.redo, Cut=self.editor.cut,
Copy=self.editor.copy, Paste=self.editor.paste,
Find=self.toggleSearchDock, FindNext=self.find,
FindPrevious=partial(self.find, backwards=True),
SelectAll=self.editor.selectAll, GoToLine=self.askGoToLine,
AboutQt=QApplication.instance().aboutQt, About=self.about)
for action in self.findChildren(QAction):
object_name = action.objectName()
if not object_name:
continue
action_name = object_name[len(self.ACTION_PREFIX):]
icon_name = self.ACTION_ICONS.get(action_name)
if icon_name:
action.setIcon(QIcon.fromTheme(icon_name))
key = self.ACTION_KEYS.get(action_name)
if key:
action.setShortcut(key)
slot = action_slots.get(action_name)
if slot:
action.triggered.connect(slot)
if action_name in self.DISABLED_ACTIONS:
action.setEnabled(False)
for action in self.menuEdit.actions():
self.editor.addAction(action)
示例11: __init__
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def __init__(self, parent=None):
super(LoginForm, self).__init__(parent)
self.setWindowTitle("Login")
self.status_icon = QIcon.fromTheme("user-offline")
self.setWindowIcon(self.status_icon)
self.server_status = QLabel()
self.server_status.setAlignment(Qt.AlignCenter)
self.server_status.setPixmap(self.status_icon.pixmap(64))
self.username = QLineEdit("Username")
self.password = QLineEdit("Password")
self.password.setEchoMode(QLineEdit.Password)
self.login_button = QPushButton("Getting server status...")
self.login_button.setEnabled(False)
self.login_button.clicked.connect(self.login)
self.login_button.setIcon(self.status_icon)
self.ping_timer = QTimer(self)
self.connect(self.ping_timer, SIGNAL("timeout()"), self.is_server_up)
self.ping_timer.start(1000)
layout = QVBoxLayout()
for w in (self.server_status, self.username, self.password, self.login_button):
layout.addWidget(w)
self.setLayout(layout)
self.logged_in.connect(qtclient.login)
示例12: tag_context_menu
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def tag_context_menu(self, pos):
index = self.ui.tagsList.currentIndex()
item = self.tagsModel.itemFromIndex(index)
if hasattr(item, 'tag'):
menu = QMenu(self.ui.tagsList)
menu.addAction(QIcon.fromTheme('gtk-delete'), self.tr('Remove'), self.remove_tag)
menu.exec_(self.ui.tagsList.mapToGlobal(pos))
示例13: start
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def start(self):
incomplete = []
if self.google_radio.isChecked():
if not self.username.text():
incomplete.append(self.username)
if not self.password.text():
incomplete.append(self.password)
if not self.document_id.text():
incomplete.append(self.document_id)
elif not self.csv_file.text():
incomplete.append(self.csv_file)
if not self.dbf_file.text():
incomplete.append(self.dbf_file)
if len(incomplete) > 0:
mbox = QMessageBox(self)
mbox.setWindowTitle("Warning, incomplete fields!")
mbox.setIcon(QMessageBox.Warning)
mbox.setWindowIcon(QIcon.fromTheme("dialog-warning"))
mbox.setText("%d fields are incomplete" % len(incomplete))
mbox.exec()
for field in self.changed_styles:
field.setStyleSheet("")
for field in incomplete:
field.setStyleSheet("border: 1.5px solid red; border-radius: 5px")
self.changed_styles = incomplete.copy()
return
for field in self.changed_styles:
field.setStyleSheet("")
self.setStatusTip("Working...")
self.working_thread = WorkThread(self)
self.working_thread.finished.connect(self.finished_start)
self.working_thread.start()
示例14: init_notebooks
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def init_notebooks(self):
frame = QFrame()
layout = QVBoxLayout()
frame.setLayout(layout)
self.ui.scrollArea.setWidget(frame)
for notebook_struct in self.app.provider.list_notebooks():
notebook = Notebook.from_tuple(notebook_struct)
count = self.app.provider.get_notebook_notes_count(notebook.id)
widget = QWidget()
menu = QMenu(self)
menu.addAction(self.tr('Change Name'), Slot()(partial(
self.change_notebook, notebook=notebook,
)))
action = menu.addAction(self.tr('Remove Notebook'), Slot()(partial(
self.remove_notebook, notebook=notebook,
)))
action.setEnabled(False)
widget.ui = Ui_Notebook()
widget.ui.setupUi(widget)
widget.ui.name.setText(notebook.name)
widget.ui.content.setText(self.tr('Containts %d notes') % count)
widget.ui.actionBtn.setIcon(QIcon.fromTheme('gtk-properties'))
widget.setFixedHeight(50)
layout.addWidget(widget)
widget.ui.actionBtn.clicked.connect(Slot()(partial(
self.show_notebook_menu,
menu=menu, widget=widget,
)))
示例15: setup_gui
# 需要导入模块: from PySide.QtGui import QIcon [as 别名]
# 或者: from PySide.QtGui.QIcon import fromTheme [as 别名]
def setup_gui(self):
"""Sets up a sample gui interface."""
central_widget = QWidget(self)
central_widget.setObjectName('central_widget')
self.label = QLabel('Hello World')
self.input_field = QLineEdit()
change_button = QPushButton('Change text')
close_button = QPushButton('close')
quit_button = QPushButton('quit')
central_layout = QVBoxLayout()
button_layout = QHBoxLayout()
central_layout.addWidget(self.label)
central_layout.addWidget(self.input_field)
# a separate layout to display buttons horizontal
button_layout.addWidget(change_button)
button_layout.addWidget(close_button)
button_layout.addWidget(quit_button)
central_layout.addLayout(button_layout)
central_widget.setLayout(central_layout)
self.setCentralWidget(central_widget)
# create a system tray icon. Uncomment the second form, to have an
# icon assigned, otherwise you will only be seeing an empty space in
# system tray
self.systemtrayicon = QSystemTrayIcon(self)
self.systemtrayicon.show()
# set a fancy icon
self.systemtrayicon.setIcon(QIcon.fromTheme('help-browser'))
change_button.clicked.connect(self.change_text)
quit_button.clicked.connect(QApplication.instance().quit)
close_button.clicked.connect(self.hide)
# show main window, if the system tray icon was clicked
self.systemtrayicon.activated.connect(self.icon_activated)