def __init__(self, peer, *args, **kwds):
        self.peer = peer

        # begin wxGlade: BookmarkPropsDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_name = wx.StaticText(self, -1, _("Name :"))
        self.text_ctrl_name = wx.TextCtrl(self, -1, "")
        self.label_url = wx.StaticText(self, -1, _("Address :"))
        self.value_url = wx.StaticText(self, -1, "")
        self.button_copy_url = wx.Button(self, wx.ID_COPY, "")
        self.label_id = wx.StaticText(self, -1, _("Node ID :"))
        self.value_id = wx.StaticText(self, -1, "")
        self.button_close = wx.Button(self, wx.ID_CLOSE, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnCopyURL, id=wx.ID_COPY)
        self.Bind(wx.EVT_BUTTON, self.OnClose, id=wx.ID_CLOSE)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Initialize UI values
        self.text_ctrl_name.SetValue(self.peer.pseudo)
        self.value_url.SetLabel(self._GetURL())
        self.value_id.SetLabel(self.peer.id_)
        self.SetTitle(_("Properties for %s") % self.peer.pseudo.strip())
        self._UpdateUI()
 def __do_layout(self):
     # begin wxGlade: ViewerFrame.__do_layout
     viewer_sizer = wx.BoxSizer(wx.VERTICAL)
     file_sizer = wx.BoxSizer(wx.VERTICAL)
     blog_sizer = wx.BoxSizer(wx.VERTICAL)
     view_sizer = wx.BoxSizer(wx.HORIZONTAL)
     view_sizer.Add(self.html_view, 1, wx.EXPAND, 0)
     self.view_tab.SetAutoLayout(True)
     self.view_tab.SetSizer(view_sizer)
     view_sizer.Fit(self.view_tab)
     view_sizer.SetSizeHints(self.view_tab)
     blog_sizer.Add(self.blog_panel, 1, wx.EXPAND, 0)
     self.blog_tab.SetAutoLayout(True)
     self.blog_tab.SetSizer(blog_sizer)
     blog_sizer.Fit(self.blog_tab)
     blog_sizer.SetSizeHints(self.blog_tab)
     file_sizer.Add(self.file_panel, 1, wx.EXPAND, 0)
     self.file_tab.SetAutoLayout(True)
     self.file_tab.SetSizer(file_sizer)
     file_sizer.Fit(self.file_tab)
     file_sizer.SetSizeHints(self.file_tab)
     self.viewer_book.AddPage(self.view_tab, _("View"))
     self.viewer_book.AddPage(self.blog_tab, _("Blog"))
     self.viewer_book.AddPage(self.file_tab, _("Files"))
     viewer_sizer.Add(self.viewer_book, 1, wx.EXPAND, 0)
     self.SetAutoLayout(True)
     self.SetSizer(viewer_sizer)
     self.Layout()
     self.Centre()
 def PopulateList(self):
     self.matches_list.InsertColumn(0, _("Name"))
     self.matches_list.InsertColumn(1, _("Filter"))
     self.matches_list.InsertColumn(2, _("Matches"))
     self.matches_list.SetColumnWidth(0, 100)
     self.matches_list.SetColumnWidth(1, 100)
     self.matches_list.SetColumnWidth(2, 200)
    def __init__(self, config_data, *args, **kwds):
        self.config_data = config_data
        self.jump_position = JumpPosition()

        # begin wxGlade: PositionJumpDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_jump = wx.StaticText(self, -1, _("Please enter the position to jump to:"))
        self.label_x = wx.StaticText(self, -1, _("X: "))
        self.text_ctrl_x = wx.TextCtrl(self, -1, "")
        self.label_y = wx.StaticText(self, -1, _("Y: "))
        self.text_ctrl_y = wx.TextCtrl(self, -1, "")
        self.button_random = wx.Button(self, -1, _("Random..."))
        self.button_ok = wx.Button(self, wx.ID_OK, "")
        self.button_cancel = wx.Button(self, wx.ID_CANCEL, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnRandomButton, self.button_random)
        self.Bind(wx.EVT_BUTTON, self.OnOk, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.OnCancel)

        # Set up validators
        _ref = self.jump_position.Ref
        self.text_ctrl_x.SetValidator(CoordValidator(_ref("x")))
        self.text_ctrl_y.SetValidator(CoordValidator(_ref("y")))

        # Initialize UI values
        self._UpdateUI()
 def Enable(self):
     """
     Enable the service.
     """
     # Set up avatar GUI
     dialog = ConfigDialog(self, self.service_api.GetDirectory())
     self.ui = UIProxy(dialog)
     # Set up main GUI hooks
     main_window = self.service_api.GetMainWindow()
     menu = wx.Menu()
     item_id = wx.NewId()
     menu.Append(item_id, _("&Configure"))
     wx.EVT_MENU(main_window, item_id, self.Configure)
     item_id = wx.NewId()
     menu.Append(item_id, "%s\tCtrl++" % _("Stretch avatars"))
     #~ menu.Append(item_id, "%s" % _("Stretch avatars"))
     wx.EVT_MENU(main_window, item_id, self.StretchAvatars)
     item_id = wx.NewId()
     menu.Append(item_id, "%s\tCtrl+-" % _("Shrink avatars"))
     #~ menu.Append(item_id, "%s" % _("Shrink avatars"))
     wx.EVT_MENU(main_window, item_id, self.ShrinkAvatars)
     self.service_api.SetMenu(_("Avatar"), menu)
     # Set up network handler
     network = NetworkLauncher(self.reactor, self, self.port)
     self.network = TwistedProxy(network, self.reactor)
     # Get saved config
     self._ApplyConfig()
     # Start network
     self.network.Start()
    def __init__(self, *args, **kwds):
        # begin wxGlade: CustomPanel.__init__
        kwds["style"] = wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)
        self.keywords_sizer_staticbox = wx.StaticBox(self, -1, _("Type here interests which do not fall into any precise category. (one per line)"))
        self.action_sizer_staticbox = wx.StaticBox(self, -1, _("Specify here a field of interest. For instance: (favorite book: Harry Potter) or (instrument: piano) "))
        self.key_value = wx.TextCtrl(self, -1, _("favorite book"))
        self.custom_value = wx.TextCtrl(self, -1, _("Harry Potter"))
        self.add_custom_button = wx.BitmapButton(self, -1, wx.Bitmap(ADD_CUSTOM(),wx.BITMAP_TYPE_ANY))
        self.del_custom_button = wx.BitmapButton(self, -1, wx.Bitmap(DEL_CUSTOM(),wx.BITMAP_TYPE_ANY))
        self.custom_list = wx.ListCtrl(self, -1, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_SORT_ASCENDING|wx.NO_BORDER)
        self.hobbies_value = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.HSCROLL|wx.TE_RICH2|wx.TE_LINEWRAP)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

        self.il = wx.ImageList(16, 16)
        self.sm_up = self.il.Add(getSmallUpArrowBitmap())
        self.sm_dn = self.il.Add(getSmallDnArrowBitmap())
        self.custom_list.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
                
        self.PopulateList()
        
        self.facade = get_facade()
        self.bind_controls()
        self.edited_item = None
    def __init__(self, parent, id, plugin=None, **kwds):
        UIProxyReceiver.__init__(self)
        self.data = {}
        self.plugin = plugin
        self.peer_desc = None
        self.active = False
        args = (parent, id)
        # begin wxGlade: FileDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.THICK_FRAME
        wx.Dialog.__init__(self, *args, **kwds)
        self.fileaction_sizer_staticbox = wx.StaticBox(self, -1, _("Actions"))
        self.label_1 = wx.StaticText(self, -1, _("Incoming dir:"))
        self.repo_value = wx.TextCtrl(self, -1, "")
        self.repo_button = wx.BitmapButton(self, -1, wx.Bitmap(DOWNLOAD_DIR(), wx.BITMAP_TYPE_ANY))
        self.download_button = wx.BitmapButton(self, -1, wx.Bitmap(DOWNLOAD(), wx.BITMAP_TYPE_ANY))
        self.peerfiles_list = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

        self.peerfiles_list.InsertColumn(NAME_COL, "File")
        self.peerfiles_list.InsertColumn(TAG_COL, "Tag")
        self.peerfiles_list.InsertColumn(SIZE_COL, "Size")
        self.peerfiles_list.SetColumnWidth(NAME_COL, 150)
        self.peerfiles_list.SetColumnWidth(SIZE_COL, 60)
        self.peerfiles_list.SetColumnWidth(TAG_COL, wx.LIST_AUTOSIZE_USEHEADER)
        self.bind_controls()
 def __do_layout(self):
     # begin wxGlade: PreferencesDialog.__do_layout
     sizer_12 = wx.BoxSizer(wx.VERTICAL)
     sizer_14 = wx.BoxSizer(wx.VERTICAL)
     sizer_15 = wx.BoxSizer(wx.HORIZONTAL)
     sizer_13 = wx.BoxSizer(wx.VERTICAL)
     sizer_13.Add(self.checkbox_multiple_identities, 0, wx.ALL, 3)
     sizer_13.Add(self.checkbox_autokill, 0, wx.ALL, 3)
     self.notebook_prefs_pane_1.SetAutoLayout(True)
     self.notebook_prefs_pane_1.SetSizer(sizer_13)
     sizer_13.Fit(self.notebook_prefs_pane_1)
     sizer_13.SetSizeHints(self.notebook_prefs_pane_1)
     sizer_14.Add(self.label_proxy, 0, wx.ALL, 3)
     sizer_14.Add(self.button_auto_proxy, 0, wx.ALL, 3)
     sizer_14.Add(self.button_no_proxy, 0, wx.ALL, 3)
     sizer_14.Add(self.button_manual_proxy, 0, wx.ALL, 3)
     sizer_15.Add((30, 5), 0, wx.ADJUST_MINSIZE, 0)
     sizer_15.Add(self.label_proxy_host, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 3)
     sizer_15.Add(self.text_ctrl_proxy_host, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 3)
     sizer_15.Add(self.label_proxy_port, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 3)
     sizer_15.Add(self.text_ctrl_proxy_port, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 3)
     sizer_14.Add(sizer_15, 0, wx.EXPAND, 0)
     self.notebook_prefs_pane_2.SetAutoLayout(True)
     self.notebook_prefs_pane_2.SetSizer(sizer_14)
     sizer_14.Fit(self.notebook_prefs_pane_2)
     sizer_14.SetSizeHints(self.notebook_prefs_pane_2)
     self.notebook_prefs.AddPage(self.notebook_prefs_pane_1, _("General"))
     self.notebook_prefs.AddPage(self.notebook_prefs_pane_2, _("Proxy"))
     sizer_12.Add(self.notebook_prefs, 1, wx.EXPAND, 0)
     sizer_12.Add(self.button_close, 0, wx.ALL|wx.ALIGN_BOTTOM|wx.ALIGN_CENTER_HORIZONTAL, 5)
     self.SetAutoLayout(True)
     self.SetSizer(sizer_12)
     sizer_12.Fit(self)
     sizer_12.SetSizeHints(self)
     self.Layout()
    def __init__(self, config_data, *args, **kwds):
        self.config_data = config_data

        # begin wxGlade: ConnectionTypeDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME
        wx.Dialog.__init__(self, *args, **kwds)
        self.radio_btn_local = wx.RadioButton(self, -1, _("Launch a dedicated Solipsis node \non this computer."), style=wx.RB_SINGLE)
        self.label_local_port = wx.StaticText(self, -1, _("Use UDP port:"))
        self.text_ctrl_local_port = wx.TextCtrl(self, -1, "")
        self.radio_btn_remote = wx.RadioButton(self, -1, _("Connect using an existing Solipsis node \n(possibly on a remote computer):"), style=wx.RB_SINGLE)
        self.label_remote_host = wx.StaticText(self, -1, _("Host:"))
        self.text_ctrl_remote_host = wx.TextCtrl(self, -1, "")
        self.label_remote_port = wx.StaticText(self, -1, _("Port:"))
        self.text_ctrl_remote_port = wx.TextCtrl(self, -1, "")
        self.button_close = wx.Button(self, wx.ID_CLOSE, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioLocal, self.radio_btn_local)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioRemote, self.radio_btn_remote)
        self.Bind(wx.EVT_BUTTON, self.OnClose, id=wx.ID_CLOSE)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Initialize UI values
        conntype = self.config_data.connection_type
        self.radio_btn_local.SetValue(conntype == 'local')
        self.radio_btn_remote.SetValue(conntype == 'remote')
        self.text_ctrl_local_port.SetValue(str(self.config_data.solipsis_port))
        self.text_ctrl_remote_host.SetValue(self.config_data.host)
        self.text_ctrl_remote_port.SetValue(str(self.config_data.port))
        self._UpdateUI()
    def __init__(self, config_data, *args, **kwds):
        self.config_data = config_data

        # begin wxGlade: ConnectDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME
        wx.Dialog.__init__(self, *args, **kwds)
        self.sizer_5_staticbox = wx.StaticBox(self, -1, _("Connection type"))
        self.label_pseudo = wx.StaticText(self, -1, _("Name or pseudo"))
        self.text_ctrl_pseudo = wx.TextCtrl(self, -1, "")
        self.label_conntype = wx.StaticText(self, -1, "")
        self.button_change_conntype = wx.Button(self, -1, _("Change"))
        self.button_ok = wx.Button(self, wx.ID_OK, "")
        self.button_cancel = wx.Button(self, wx.ID_CANCEL, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT, self.OnPseudoChanged, self.text_ctrl_pseudo)
        self.Bind(wx.EVT_BUTTON, self.OnChangeConnType, self.button_change_conntype)
        self.Bind(wx.EVT_BUTTON, self.OnOk, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id=wx.ID_CANCEL)
        # end wxGlade

        self.text_ctrl_pseudo.SetValue(config_data.pseudo)
        self._UpdateUI()
 def __set_properties(self):
     # begin wxGlade: ConnectionTypeDialog.__set_properties
     self.SetTitle(_("Connection type"))
     self.text_ctrl_local_port.SetToolTipString(_("This is the port number used to contact other peers. Usually you don't have to change its value."))
     self.text_ctrl_remote_host.SetMinSize((160, -1))
     self.text_ctrl_remote_host.SetToolTipString(_("Name or IP address of the machine on which the node is running"))
     self.button_close.SetDefault()
    def __init__(self, *args, **kwds):
        # begin wxGlade: OthersPanel.__init__
        kwds["style"] = wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)
        self.other_split = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER)
        self.details_panel = wx.Panel(self.other_split, -1)
        self.peers_panel = wx.Panel(self.other_split, -1)
        self.peers_list = wx.TreeCtrl(self.peers_panel, -1, style=wx.TR_HAS_BUTTONS|wx.TR_LINES_AT_ROOT|wx.TR_DEFAULT_STYLE|wx.SUNKEN_BORDER)
        self.detail_preview = wx.html.HtmlWindow(self.details_panel, -1)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

        root = self.peers_list.AddRoot(_("Peers"))
        self.friends = self.peers_list.AppendItem(root, _("Friends"))
        self.anonymous = self.peers_list.AppendItem(root, _("Anonymous"))
        self.blacklisted = self.peers_list.AppendItem(root, _("Blacklisted"))

        self.frame = self
        # FIXME dirty but isinstance on ProfileFrame not working...
        while self.frame and (not hasattr(self.frame, 'enable_peer_states')):
            self.frame = self.frame.GetParent()
        self.facade = get_facade()
        self.peers = None
        self.bind_controls()
Beispiel #13
0
 def GetPointToPointActions(self):
     """
     Returns an array of strings advertising point-to-point actions
     with another peer, or None if point-to-point actions are not allowed.
     """
     return [_("Show info"),
             _("Request profile"),]
 def __set_properties(self):
     # begin wxGlade: BlogPanel.__set_properties
     self.add_blog_button.SetToolTipString(_("Post"))
     self.add_blog_button.SetSize(self.add_blog_button.GetBestSize())
     self.del_blog_button.SetToolTipString(_("Delete selected"))
     self.del_blog_button.SetSize(self.del_blog_button.GetBestSize())
     self.comment_blog_button.SetToolTipString(_("Comment selected"))
     self.comment_blog_button.SetSize(self.comment_blog_button.GetBestSize())
    def __set_properties(self):
        # begin wxGlade: BookmarksDialog.__set_properties
        self.SetTitle(_("Bookmarks"))
        self.SetMinSize((300, 200))
        self.toolbar.Realize()
        self.button_close.SetDefault()
        # end wxGlade

        self.UpdateToolbarState()
        self.list_ctrl.InsertColumn(COL_PSEUDO, _("Pseudo"))
    def __set_properties(self):
        # begin wxGlade: PreferencesDialog.__set_properties
        self.SetTitle(_("Preferences"))
        self.checkbox_multiple_identities.SetToolTipString(_("Checking this box will allow to manage multiple identities from the connection box."))
        self.checkbox_autokill.SetToolTipString(_("Uncheck this box if you want to remain connected to the Solipsis world even when you exit the navigator."))
        self.button_close.SetDefault()
        # end wxGlade

        # BUG: this doesn't seem to work
        self.SetExtraStyle(self.GetExtraStyle() | wx.WS_EX_VALIDATE_RECURSIVELY)
 def OnClose(self, event): # wxGlade: BookmarkPropsDialog.<event_handler>
     if self._Validate():
         self._Apply()
         self.EndModal(wx.ID_OK)
     else:
         dialog = wx.MessageDialog(self,
             message=_("Please enter a name for this bookmark."),
             caption=_("Error"),
             style=wx.OK | wx.ICON_ERROR)
         dialog.ShowModal()
 def __do_layout(self):
     # begin wxGlade: FilterFrame.__do_layout
     frame_sizer = wx.BoxSizer(wx.VERTICAL)
     self.filter_book.AddPage(self.personal_filter_tab, _("Personal"))
     self.filter_book.AddPage(self.file_filter_tab, _("Files"))
     frame_sizer.Add(self.filter_book, 1, wx.EXPAND, 0)
     self.SetAutoLayout(True)
     self.SetSizer(frame_sizer)
     self.Layout()
     self.Centre()
 def OnClose(self, event): # wxGlade: ConnectionTypeDialog.<event_handler>
     if self._Validate():
         self._Apply()
         self.EndModal(wx.ID_OK)
     else:
         dialog = wx.MessageDialog(self,
             message=_("Some parameters have wrong values.\nPlease enter proper values."),
             caption=_("Error"),
             style=wx.OK | wx.ICON_ERROR)
         dialog.ShowModal()
 def __set_properties(self):
     """init widgets properties"""
     # begin wxGlade: FilePanel.__set_properties
     self.tag_value.SetToolTipString(_("Complementary information on file"))
     self.edit_button.SetToolTipString(_("Tag"))
     self.edit_button.SetSize(self.edit_button.GetBestSize())
     self.share_button.SetToolTipString(_("Share"))
     self.share_button.SetSize(self.share_button.GetBestSize())
     self.unshare_button.SetToolTipString(_("Unshare"))
     self.unshare_button.SetSize(self.unshare_button.GetBestSize())
Beispiel #21
0
 def _UpdateWindowTitle(self):
     """
     Update the main window's title.
     """
     connected = self._CheckNodeProxy(False)
     if connected:
         pseudo = self.config_data.GetNode().pseudo
         title = _("%s - Solipsis") % pseudo
     else:
         title = _("Disconnected - Solipsis")
     self.main_window.SetTitle(title)
Beispiel #22
0
 def Enable(self):
     # Set up chat GUI
     window = ChatWindow(self, self.service_api.GetDirectory())
     main_window = self.service_api.GetMainWindow()
     self.ui = UIProxy(window)
     # Set up main GUI hooks
     menu = wx.Menu()
     item_id = wx.NewId()
     menu.Append(item_id, _(self.str_action))
     wx.EVT_MENU(main_window, item_id, self.DoAction)
     self.service_api.SetMenu(_("Chat"), menu)
 def __set_properties(self):
     # begin wxGlade: FileDialog.__set_properties
     self.SetTitle(_("Chose Files"))
     self.SetSize((460, 410))
     self.repo_button.SetToolTipString(_("Dowload repository"))
     self.repo_button.SetSize(self.repo_button.GetBestSize())
     self.download_button.SetToolTipString(_("Download selected files"))
     self.download_button.SetSize(self.download_button.GetBestSize())
     # end wxGlade
     if not self.plugin:
         self.download_button.Enable(False)
 def on_export(self, evt):
     """export .html"""
     dlg = wx.FileDialog(
         self, message=_("Export HTML file as ..."),
         defaultDir=get_prefs("profile_dir"),
         defaultFile="%s.html"% get_facade()._desc.document.get_pseudo(),
         wildcard=_("HTML File (*.html)|*.html"),
         style=wx.SAVE)
     if dlg.ShowModal() == wx.ID_OK:
         path = dlg.GetPath()
         get_facade().export_profile(path)
 def __set_properties(self):
     # begin wxGlade: AboutDialog.__set_properties
     self.SetTitle(_("About Profile"))
     self.SetSize((300, 300))
     self.tore_pic.SetMinSize((300, 156))
     self.disclaimer_lbl.SetBackgroundColour(wx.Colour(226, 226, 226))
     self.disclaimer_lbl.Enable(False)
     self.display_check.SetValue(1)
     # end wxGlade
     self.SetTitle("%s %s"% (_("Solipsis Profile"), VERSION))
     self.display_check.SetValue(self.display)
     self.disclaimer_lbl.SetValue(DISCLAIMER)
 def __set_properties(self):
     # begin wxGlade: FileDialog.__set_properties
     self.SetTitle(_("Chose Files"))
     self.SetSize((460, 410))
     self.repo_button.SetToolTipString(_("Dowload repository"))
     self.repo_button.SetSize(self.repo_button.GetBestSize())
     self.download_button.SetToolTipString(_("Download selected files"))
     self.download_button.SetSize(self.download_button.GetBestSize())
     # end wxGlade
     self.repo_value.SetValue(unicode(get_prefs().get("download_repo"), ENCODING))
     if not self.plugin:
         self.download_button.Enable(False)
    def __init__(self, app, world, config_data, menu, *args, **kwds):
        self.app = app
        self.world = world
        self.config_data = config_data
        self.menu = menu

        # Item index => peer
        self.item_map = {}
        # Peer IDs
        self.selected_items = set()
        # Menu items
        self.menu_items = []

        # begin wxGlade: BookmarksDialog.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = wx.Panel(self, -1)

        # Tool Bar
        self.toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL|wx.TB_TEXT|wx.TB_HORZ_LAYOUT|wx.TB_HORZ_TEXT)
        self.SetToolBar(self.toolbar)
        self.toolbar.AddLabelTool(TOOL_ADD_BOOKMARK, _("Add bookmark"), (TB(wx.ART_ADD_BOOKMARK)), wx.NullBitmap, wx.ITEM_NORMAL, _("Remember one of your current neighbours"), "")
        self.toolbar.AddLabelTool(TOOL_DEL_BOOKMARK, _("Remove"), (TB(wx.ART_DEL_BOOKMARK)), wx.NullBitmap, wx.ITEM_NORMAL, _("Remove selected bookmark"), "")
        self.toolbar.AddLabelTool(TOOL_PROPERTIES, _("Information"), (TB(wx.ART_FILE_OPEN)), wx.NullBitmap, wx.ITEM_NORMAL, _("Get bookmark information"), "")
        # Tool Bar end
        self.list_ctrl = wx.ListCtrl(self.panel_1, -1, style=wx.LC_REPORT|wx.LC_VRULES|wx.SUNKEN_BORDER)
        self.button_close = wx.Button(self.panel_1, wx.ID_CLOSE, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TOOL, self.OnAddBookmark, id=TOOL_ADD_BOOKMARK)
        self.Bind(wx.EVT_TOOL, self.OnDelBookmark, id=TOOL_DEL_BOOKMARK)
        self.Bind(wx.EVT_TOOL, self.OnProperties, id=TOOL_PROPERTIES)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnDeselectItem, self.list_ctrl)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectItem, self.list_ctrl)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnActivateItem, self.list_ctrl)
        self.Bind(wx.EVT_BUTTON, self.OnClose, id=wx.ID_CLOSE)
        # end wxGlade
        self.Bind(wx.EVT_SHOW, self.OnShow)
        self.Bind(wx.EVT_CLOSE, self.OnClose)

        # Calculate colour for URLs, by dimming
        # between default text and background colours
        # (note: doesn't work on GTK and Aqua backends)
        rgb_front = self.GetForegroundColour().Get()
        rgb_back = self.GetBackgroundColour().Get()
        c = [f * 0.7 + b * 0.3 for (f, b) in zip(rgb_front, rgb_back)]
        self.url_colour = wx.Colour(*c)

        # Fill UI with data
        self.config_data.AskNotify(self.ApplyConfig)
        self.ApplyConfig()
 def OnAddBookmark(self, event): # wxGlade: BookmarksDialog.<event_handler>
     all_peers = self.world.GetAllPeers()
     bookmarked_peers = set([peer.id_ for peer in self.bookmarks.GetAllPeers()])
     peers = [peer for peer in all_peers if peer.id_ not in bookmarked_peers]
     dialog = wx.SingleChoiceDialog(parent=self,
         message=_("Please choose the peer to add to your bookmarks list."),
         caption=_("Add bookmark"),
         choices=[peer.pseudo for peer in peers])
     if dialog.ShowModal() == wx.ID_OK:
         peer = peers[dialog.GetSelection()]
         self.bookmarks.AddPeer(peer)
         self.UpdateUI()
 def __do_layout(self):
     """generated by SetTitle"""
     # begin wxGlade: EditorFrame.__do_layout
     frame_sizer = wx.BoxSizer(wx.VERTICAL)
     self.profile_book.AddPage(self.personal_tab, _("Personal"))
     self.profile_book.AddPage(self.blog_tab, _("Blog"))
     self.profile_book.AddPage(self.file_tab, _("Files"))
     frame_sizer.Add(self.profile_book, 1, wx.EXPAND, 0)
     self.SetAutoLayout(True)
     self.SetSizer(frame_sizer)
     self.Layout()
     self.Centre()
Beispiel #30
0
 def _OnJumpNear(self, evt):
     """
     Called on "jump near" event (menu -> Actions -> Jump near).
     """
     if self._CheckNodeProxy():
         dialog = wx.TextEntryDialog(self.main_window,
             message=_("Please enter the address to jump to"),
             caption=_("Jump near an entity"),
             defaultValue='slp://192.33.178.29:5010/'
         )
         if dialog.ShowModal() == wx.ID_OK:
             v = dialog.GetValue()
             BaseNavigatorApp._OnJumpNear(self, v)