本文整理汇总了Python中dtk.ui.treeview.TreeView.redraw_request方法的典型用法代码示例。如果您正苦于以下问题:Python TreeView.redraw_request方法的具体用法?Python TreeView.redraw_request怎么用?Python TreeView.redraw_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtk.ui.treeview.TreeView
的用法示例。
在下文中一共展示了TreeView.redraw_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SessionView
# 需要导入模块: from dtk.ui.treeview import TreeView [as 别名]
# 或者: from dtk.ui.treeview.TreeView import redraw_request [as 别名]
#.........这里部分代码省略.........
self.delete_button.connect("clicked", self.delete_autostart)
self.delete_button.set_sensitive(False)
foot_box = FootBox(adjustment=15)
foot_box.set_buttons([add_button, self.delete_button])
self.pack_start(align, True, True)
self.pack_end(foot_box, False, False)
#self.pack_end(self.new_box, False, False)
self.show_all()
self._init_monitor()
def disable_delete_button(self, value):
self.delete_button.set_sensitive(not value)
def _init_monitor(self):
self.library_monitor = LibraryMonitor(get_user_config_dir())
self.library_monitor.set_property("monitored", True)
self.library_monitor.connect("file-added", self.refresh_list)
self.library_monitor.connect("location-removed", self.refresh_list)
def right_press_item(self, widget, x_root, y_root, current_item, select_items):
self.tmp_editing_session = current_item.item
for item in select_items:
item.unselect()
if current_item != None:
current_item.select()
if self.open_dialog == False:
dialog = NewSessionDialog(confirm_callback = self.edit_done, cancel_callback = self.cancel_callback)
dialog.name_entry.set_text(current_item.item.name)
dialog.exec_entry.set_text(current_item.item.exec_)
dialog.desc_entry.set_text(current_item.item.comment)
dialog.place_center()
dialog.show_all()
self.open_dialog = True
def create_session_item(self, dialog):
name = dialog.name_entry.get_text()
exec_ = dialog.exec_entry.get_text()
comment = dialog.desc_entry.get_text()
session_manager.add(name, exec_, comment)
self.open_dialog = False
def expose_line(self, widget, event):
cr = widget.window.cairo_create()
rect = widget.allocation
style.draw_out_line(cr, rect, exclude=["left", "right", "top"])
def sort_method(self):
pass
def add_autostart(self, widget):
if self.open_dialog == False:
dialog = NewSessionDialog(confirm_callback= self.create_session_item, cancel_callback = self.cancel_callback)
dialog.show_all()
self.open_dialog = True
def delete_autostart(self, widget):
items = map(lambda row: self.tree.visible_items[row], self.tree.select_rows)
item = items[0].item
item.delete()
self.tree.delete_select_items()
if self.tree.visible_items == []:
self.tree.add_items([NothingItem()])
def edit_done(self, dialog):
self.tmp_editing_session.set_name(dialog.name_entry.get_text())
self.tmp_editing_session.set_exec(dialog.exec_entry.get_text())
self.tmp_editing_session.set_comment(dialog.desc_entry.get_text())
self.tmp_editing_session.save()
self.tmp_editing_session = None
items = map(lambda row: self.tree.visible_items[row], self.tree.select_rows)
self.tree.redraw_request(items, True)
self.open_dialog = False
def cancel_callback(self):
self.tmp_editing_session = None
self.open_dialog = False
def pack(self, parent, widget_list, expand=False, fill=False):
for w in widget_list:
parent.pack_start(w, expand, fill)
def draw_mask(self, cr, x, y, w, h):
cr.set_source_rgb(1, 1, 1)
cr.rectangle(x, y, w, h)
cr.fill()
def get_list(self):
usr_list = session_manager.list_autostart_items()
if usr_list:
return map(lambda w: SessionItem(self, w), usr_list)
else:
return [NothingItem()]
def refresh_list(self, widget, gfile):
self.tree.clear()
self.tree.add_items(self.get_list())
self.tree.show()