本文整理汇总了Python中preferences.Preferences.remove_monitor方法的典型用法代码示例。如果您正苦于以下问题:Python Preferences.remove_monitor方法的具体用法?Python Preferences.remove_monitor怎么用?Python Preferences.remove_monitor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类preferences.Preferences
的用法示例。
在下文中一共展示了Preferences.remove_monitor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IssueView
# 需要导入模块: from preferences import Preferences [as 别名]
# 或者: from preferences.Preferences import remove_monitor [as 别名]
#.........这里部分代码省略.........
image = gtk.Image()
image.set_from_file(find_resource("icons/warning.png"))
self._button_warnings.set_icon_widget(image)
self._button_warnings.set_active(self._show_warnings)
self._handlers[self._button_warnings] = self._button_warnings.connect("toggled", self.__on_warnings_toggled)
self._button_tasks = gtk.ToggleToolButton()
self._button_tasks.set_tooltip_text("Show/Hide Tasks")
imageTask = gtk.Image()
imageTask.set_from_file(find_resource("icons/task.png"))
self._button_tasks.set_icon_widget(imageTask)
self._button_tasks.set_active(self._show_tasks)
self._handlers[self._button_tasks] = self._button_tasks.connect("toggled", self.__on_tasks_toggled)
toolbar = gtk.Toolbar()
toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
toolbar.set_style(gtk.TOOLBAR_ICONS)
toolbar.set_icon_size(gtk.ICON_SIZE_MENU)
toolbar.insert(self._button_warnings, -1)
toolbar.insert(self._button_tasks, -1)
self.pack_start(toolbar, False)
self._issues = []
self._preferences.register_monitor(self)
self._log.debug("init finished")
def _on_row_activated(self, view, path, column):
"""
A row has been double-clicked on
"""
issue = self._store.get(self._store.get_iter(path), 3)[0]
self._context.activate_editor(issue.file)
#~ # FIXME: this doesn't work correctly
#~ if not self._context.active_editor is None:
#~ self._context.active_editor.select(issue.start, issue.end)
self._editor.select(issue.start, issue.end)
def _on_value_changed(self, key, value):
if key == "IssuesShowWarnings" or key == "IssuesShowTasks":
# update filter
self._store.clear()
for issue, local in self._issues:
self.__append_issue_filtered(issue, local)
def __on_tasks_toggled(self, togglebutton):
self._show_tasks = togglebutton.get_active()
self._preferences.set("IssuesShowTasks", self._show_tasks)
def __on_warnings_toggled(self, togglebutton):
self._show_warnings = togglebutton.get_active()
self._preferences.set("IssuesShowWarnings", self._show_warnings)
def clear(self):
"""
Remove all issues from the view
"""
self.assure_init()
self._store.clear()
self._issues = []
def append_issue(self, issue, local=True):
"""
Append a new Issue to the view
@param issue: the Issue object
@param local: indicates whether the Issue occured in the edited file or not
"""
self.assure_init()
self._issues.append((issue, local))
self.__append_issue_filtered(issue, local)
def __append_issue_filtered(self, issue, local):
if issue.severity == Issue.SEVERITY_WARNING:
if self._show_warnings:
self.__do_append_issue(issue, local)
elif issue.severity == Issue.SEVERITY_TASK:
if self._show_tasks:
self.__do_append_issue(issue, local)
else:
self.__do_append_issue(issue, local)
def __do_append_issue(self, issue, local):
if local:
message = issue.message
filename = escape(issue.file.basename)
else:
message = "<span color='%s'>%s</span>" % (self._preferences.get("LightForeground", "#7f7f7f"), issue.message)
filename = "<span color='%s'>%s</span>" % (self._preferences.get("LightForeground", "#7f7f7f"), issue.file.basename)
self._store.append([self._icons[issue.severity], message, filename, issue])
def destroy(self):
del self._editor
self._preferences.remove_monitor(self)
for obj in self._handlers:
obj.disconnect(self._handlers[obj])
BottomView.destroy(self)