当前位置: 首页>>代码示例>>Python>>正文


Python prefs.get_prefs函数代码示例

本文整理汇总了Python中solipsis.services.profile.prefs.get_prefs函数的典型用法代码示例。如果您正苦于以下问题:Python get_prefs函数的具体用法?Python get_prefs怎么用?Python get_prefs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_prefs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_files

    def get_files(self, file_descriptors):
        """download given list of file

        file_descriptor is a list: [ [split path], size ]"""
        if self.peer.server.current_state == self.peer.server.new_state:
            SecurityAlert(self.peer.peer_id,
                          "Can't get files: peer's server not known yet")
        else:
            # display downlaod dialog if necessary
            if get_prefs("display_dl") \
                   and "wx" in sys.modules:
                print "xxx using wx"
                from solipsis.util.uiproxy import UIProxy
                from solipsis.services.profile.gui.DownloadDialog \
                     import DownloadDialog
                self.download_dlg = UIProxy(DownloadDialog(
                    get_prefs("display_dl"), None, -1))
                self.download_dlg.init()
                self.download_dlg.Show()
            # launch first download
            self.files = file_descriptors
            if self.files:
                split_path, size = self.files.pop()
                self.update_file(split_path[-1], size)
                self._connect(MESSAGE_FILES,
                                     format_data_file(split_path, size))
                # create deferred to be called when all files downloaded
                deferred = defer.Deferred()
                self.files_deferred = deferred
                return self.files_deferred
            else:
                display_warning(_("Empty List"),
                                _("No file selected to download"))
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:33,代码来源:peer_network.py

示例2: __set_properties

 def __set_properties(self):
     # begin wxGlade: MatchFrame.__set_properties
     self.SetTitle(_("Matches"))
     self.SetSize((460, 600))
     # end wxGlade
     width = get_prefs("match_width")
     height = get_prefs("match_height")
     self.SetSize((width, height))
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:MatchFrame.py

示例3: on_close

 def on_close(self, evt=None):
     """hide  application"""
     # save size
     new_size = self.GetSize()
     get_prefs().set("match_width", new_size.GetWidth())
     get_prefs().set("match_height", new_size.GetHeight())
     # do not destroy window
     self.Hide()
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:MatchFrame.py

示例4: on_set_repo

 def on_set_repo(self, evt):
     """set download directory according to value"""
     path = self.repo_value.GetValue()
     while path and not os.path.isdir(path):
         path = os.path.dirname(path)
     get_prefs().set("download_repo", path.encode(ENCODING))
     self.repo_value.SetValue(path)
     self.repo_button.SetToolTipString(path)
     self.SetTitle()
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:9,代码来源:FileDialog.py

示例5: SetTitle

 def SetTitle(self, title=None):
     if not title:
         if self.peer_desc:
             title = self.peer_desc.pseudo + "'s files"
         else:
             title = unicode("your files going into " + get_prefs().get("download_repo"), ENCODING)
     wx.Dialog.SetTitle(self, title)
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:7,代码来源:FileDialog.py

示例6: get_message

 def get_message(self):
     """format message to send to client according to file to be
     uploaded"""
     if self.message == MESSAGE_PROFILE:
         self.file = tempfile.NamedTemporaryFile()
         message = ASK_UPLOAD_PROFILE
     elif self.message == MESSAGE_BLOG:
         self.file = StringIO()
         message = ASK_UPLOAD_BLOG
     elif self.message == MESSAGE_SHARED:
         self.file = StringIO()
         message = ASK_UPLOAD_SHARED
     elif self.message == MESSAGE_FILES:
         # TODO: check place where to download and non overwriting
         down_path = os.path.abspath(os.path.join(
             get_prefs().get("download_repo"),
             self.split_path[-1]))
         self.file = open(down_path, "w+b")
         self.manager.download_dlg.update_file(self.split_path, self.size)
         message = "%s %s"% (ASK_UPLOAD_FILES,
                             UNIVERSAL_SEP.join(self.split_path))
     else:
         print "%s not valid"% self.message
         message = MESSAGE_ERROR
     return message
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:25,代码来源:network.py

示例7: save

 def save(self, directory=None, doc_extension=PROFILE_EXT):
     """save both document & blog"""
     if directory is None:
         directory = get_prefs("profile_dir")
     file_path = os.path.join(directory, self.node_id)
     self.document.save(file_path + doc_extension)
     self.blog.save(file_path + BLOG_EXT)
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:7,代码来源:data.py

示例8: connectionMade

 def connectionMade(self):
     """after ip is checked, begin connection"""
     PeerProtocol.connectionMade(self)
     # check action to be made
     if self.factory.download.startswith(ASK_DOWNLOAD_FILES):
         if self.factory.files:
             self.setRawMode()
             # TODO: check place where to download and non overwriting
             # create file
             file_path, size = self.factory.files.pop()
             self.factory.manager.update_file(file_path[-1], size)
             down_path = os.path.abspath(os.path.join(
                 get_prefs("download_repo"),
                 file_path[-1]))
             print "loading into", down_path
             self.file = open(down_path, "w+b")
             self.sendLine("%s %s"% (self.factory.download,
                                     UNIVERSAL_SEP.join(file_path)))
         else:
             self.factory.manager._on_all_files()
     elif self.factory.download.startswith(ASK_DOWNLOAD_BLOG)\
              or self.factory.download.startswith(ASK_DOWNLOAD_SHARED):
         self.setRawMode()
         self.file = StringIO()
         self.sendLine(self.factory.download)
     elif self.factory.download.startswith(ASK_DOWNLOAD_PROFILE):
         self.setRawMode()
         self.file = tempfile.NamedTemporaryFile()
         self.sendLine(self.factory.download)
     elif self.factory.download.startswith(ASK_UPLOAD):
         self.file = None
         self.setLineMode()
         self.sendLine(self.factory.download)
     else:
         print "unexpected command %s"% self.factory.download
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:35,代码来源:network.py

示例9: on_about

 def on_about(self, event): # wxGlade: FilterFrame.<event_handler>
     """display about"""
     # not modal because would freeze the wx thread while twisted
     # one goes on and initialize profile
     about_dlg = AboutDialog(get_prefs("disclaimer"), self, -1)
     about_dlg.Show()
     event.Skip()
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:7,代码来源:FilterFrame.py

示例10: create_filter_facade

def create_filter_facade(pseudo, directory=None):
    """implements pattern singleton on FilterFacade"""
    if directory is None:
        directory = get_prefs("profile_dir")
    if isinstance(pseudo, str):
        pseudo = unicode(pseudo, ENCODING)
    FilterFacade.filter_facade = FilterFacade(pseudo, directory)
    return FilterFacade.filter_facade
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:facade.py

示例11: SetTitle

 def SetTitle(self, title=None):
     if not title:
         if self.peer_desc:
             title = self.peer_desc.document.get_pseudo() + "'s files"
         else:
             title = force_unicode("your files going into " + \
                             get_prefs("download_repo"))
     wx.Dialog.SetTitle(self, title)
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:FileDialog.py

示例12: __init__

 def __init__(self, pseudo, directory=None):
     assert isinstance(pseudo, unicode), "pseudo must be a unicode"
     if directory is None:
         directory = get_prefs("profile_dir")
     AbstractPersonalData.__init__(self)
     AbstractSharingData.__init__(self)
     AbstractContactsData.__init__(self)
     SaverMixin.__init__(self, pseudo, directory)
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:document.py

示例13: __init__

 def __init__(self, pseudo, directory=None):
     assert isinstance(pseudo, unicode), "pseudo must be a unicode"
     if directory is None:
         directory = get_prefs("profile_dir")
     self._desc = None
     self.pseudo = pseudo
     self._activated = True
     self.views = {}
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:8,代码来源:simple_facade.py

示例14: __set_properties

    def __set_properties(self):
        # begin wxGlade: FilterFrame.__set_properties
        self.SetTitle(_("Profile Filters"))
        self.SetSize((709, 632))
        self.statusbar.SetStatusWidths([-1])
        # statusbar fields
        statusbar_fields = [_("status")]
        for i in range(len(statusbar_fields)):
            self.statusbar.SetStatusText(statusbar_fields[i], i)
        # end wxGlade

        # properties not generated by wxglade
        width = get_prefs("filter_width")
        height = get_prefs("filter_height")
        self.SetSize((width, height))
        self.do_modified(False)
        self.activate_item.Check()
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:17,代码来源:FilterFrame.py

示例15: on_browse_repo

 def on_browse_repo(self, evt):
     """select download directory in DirDialog"""
     # pop up to choose repository
     dlg = wx.DirDialog(
         self,
         message=_("Choose location to download files into"),
         defaultPath=unicode(get_prefs().get("download_repo"), ENCODING),
         style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON,
     )
     if dlg.ShowModal() == wx.ID_OK:
         # path chosen
         path = dlg.GetPath()
         get_prefs().set("download_repo", path.encode(ENCODING))
         self.repo_value.SetValue(path)
         self.repo_button.SetToolTipString(path)
         self.SetTitle()
     dlg.Destroy()
开发者ID:BackupTheBerlios,项目名称:solipsis-svn,代码行数:17,代码来源:FileDialog.py


注:本文中的solipsis.services.profile.prefs.get_prefs函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。