本文整理汇总了Python中solipsis.services.profile.facade.get_facade函数的典型用法代码示例。如果您正苦于以下问题:Python get_facade函数的具体用法?Python get_facade怎么用?Python get_facade使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_facade函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_blacklist
def on_blacklist(self, evt):
"""end application"""
pseudo = self.other_tab.get_peer_selected()
if pseudo:
get_facade().blacklist_peer(pseudo)
else:
print "no peer selected"
示例2: on_anonymous
def on_anonymous(self, evt):
"""end application"""
pseudo = self.other_tab.get_peer_selected()
if pseudo:
get_facade().unmark_peer(pseudo)
else:
print "no peer selected"
示例3: on_close
def on_close(self, evt):
"""hide application"""
get_facade().save()
if self.options["standalone"]:
self._close()
else:
self.Hide()
示例4: on_make_friend
def on_make_friend(self, evt):
"""end application"""
pseudo = self.other_tab.get_peer_selected()
if pseudo:
get_facade().make_friend(pseudo)
else:
print "no peer selected"
示例5: Disable
def Disable(self):
"""It is called when the user chooses to disable the service."""
# ask for saving (ca not simply call Close() on editor frame
# method because of multithreading and the frame is destroyed
# before the user actually answer to the popup
if self.editor_frame and self.editor_frame.modified:
import wx
self.editor_frame.do_modified(False)
dlg = wx.MessageDialog(
self.editor_frame,
'Your profile has been modified. Do you want to save it?',
'Saving Profile',
wx.YES_NO | wx.ICON_INFORMATION)
if dlg.ShowModal() == wx.ID_YES:
get_facade()._desc.save()
if self.filter_frame and self.filter_frame.modified:
import wx
self.filter_frame.do_modified(False)
dlg = wx.MessageDialog(
self.filter_frame,
'Your filters have been modified. Do you want to save them?',
'Saving Filters',
wx.YES_NO | wx.ICON_INFORMATION)
if dlg.ShowModal() == wx.ID_YES:
get_filter_facade().save()
self.activate(False)
示例6: refresh
def refresh(self, files=None):
"""overrides Show, files is {repos: [FileDescriptors], }"""
if not self.IsShown():
return
if files is None:
if get_facade() is None:
return
files = get_facade()._desc.document.get_shared_files()
# clear previous data
self.peerfiles_list.DeleteAllItems()
for key in self.data.keys():
del self.data[key]
# fill new data
for file_container in files.flatten():
path = file_container.get_path()
index = self.peerfiles_list.InsertStringItem(
sys.maxint, force_unicode(file_container.name))
self.peerfiles_list.SetStringItem(index, TAG_COL, file_container._tag)
self.peerfiles_list.SetStringItem(index, SIZE_COL,
formatbytes(file_container.size,
kiloname="Ko",
meganame="Mo",
bytename="o"))
self.data[index] = (path.split(os.sep), file_container.size)
# show result
self.peerfiles_list.SetColumnWidth(TAG_COL, wx.LIST_AUTOSIZE)
示例7: on_tag
def on_tag(self, evt):
"""tag selected files or directory"""
dir_name = self.owner.tree_list.GetItemText(self.owner.tree_list.GetSelection(), FULL_PATH_COL)
file_names = [self.owner.dir_list.GetItemText(item)
for item in self.owner._get_selected_listitems()]
get_facade().tag_files((dir_name, file_names, self.owner.tag_value.GetValue()))
self.owner.do_modified(True)
示例8: on_refresh
def on_refresh(self, evt):
"""put into cache new information when dir expanded in tree"""
self.current_state = self.tree_state
file_name = self.tree_list.GetItemText(self.tree_list.GetSelection(), FULL_PATH_COL)
if self.tree_list.GetSelection() != self.root:
get_facade().recursive_expand(abspath(file_name))
evt.Skip()
示例9: remove_blog
def remove_blog(self):
assert get_facade(), "Facade not initialiazed"
selected = self.GetSelection()
if selected != wx.NOT_FOUND:
get_facade().remove_blog(selected)
else:
print "none selected"
示例10: _on_new_profile
def _on_new_profile(self, document, peer_id):
"""store and display file object corresponding to profile"""
print "downloaded profile", peer_id
get_facade().fill_data((peer_id, document))
if self.viewer_frame:
self.viewer_frame.profile_dlg.activate()
self.viewer_frame.profile_dlg.Show()
示例11: on_del
def on_del(self, evt):
"""a custom attribute has been modified"""
# update data
if self.custom_list.DeleteItem(self.custom_list.FindItem(0, self.key_value.GetValue())):
# update cache
get_facade().del_custom_attributes(self.key_value.GetValue())
self.do_modified(True)
示例12: _on_new_profile
def _on_new_profile(self, document, peer_id):
"""store and display file object corresponding to profile"""
if self.viewer_frame:
self.viewer_frame.profile_dlg.activate()
self.viewer_frame.profile_dlg.Show()
get_facade().fill_data((peer_id, document))
return str(document)
示例13: on_unshare
def on_unshare(self, evt):
"""cancel sharing of selected files"""
dir_name = self.owner.tree_list.GetItemText(self.owner.tree_list.GetSelection(), FULL_PATH_COL)
file_names = [self.owner.dir_list.GetItemText(item)
for item in self.owner._get_selected_listitems()]
get_facade().share_files(dir_name, file_names, False)
self.owner.do_modified(True)
示例14: remove_blog
def remove_blog(self):
assert get_facade(), "Facade not initialiazed"
selected = self.GetSelection()
if selected != wx.NOT_FOUND:
get_facade().remove_blog(selected)
else:
display_warning(_("none selected"))
示例15: refresh
def refresh(self, files=None):
"""overrides Show, files is {repos: [FileDescriptors], }"""
if files is None:
if get_facade() is None:
return
files = get_facade().get_document().get_shared_files()
self.peerfiles_list.DeleteAllItems()
if len(files) > 0:
# reformat data
file_data = []
for file_descs in files.values():
for file_desc in file_descs:
file_data.append([file_desc.get_path(),
file_desc.name,
file_desc._tag])
# clear previous data
for key in self.data.keys():
del self.data[key]
# fill list
for path, name, tag in file_data:
index = self.peerfiles_list.InsertStringItem(sys.maxint, name)
self.peerfiles_list.SetStringItem(index, 1, tag)
self.data[index] = path.split(os.sep)
# show result
self.peerfiles_list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
self.peerfiles_list.SetColumnWidth(1, wx.LIST_AUTOSIZE)