示例#1
0
 def GetDownloadLocation(self):
     """Returns the path that the file will be downloaded to.
     Currently will either return the users Desktop path or the
     users home directory in the case that there is no deskop directory
     @return: path to download file
     
     """
     dl_loc = wx.GetHomeDir() + util.GetPathChar()
     if os.path.exists(dl_loc + u"Desktop"):
         dl_loc = dl_loc + u"Desktop" + util.GetPathChar()
     return dl_loc
示例#2
0
def GetLoader():
    """Finds the loader to use"""
    user_home = wx.GetHomeDir() + util.GetPathChar()
    rel_prof_path = ("." + PROG_NAME + util.GetPathChar() + 
                     "profiles" + util.GetPathChar() + ".loader2")

    if os.path.exists(user_home + rel_prof_path):
        loader = user_home + rel_prof_path
    else:
        loader = CONFIG['PROFILE_DIR'] + ".loader2"

    return loader
示例#3
0
    def GetPaths(self):
        """Gets a list of abs paths of the selected items"""
        treeIds = self._tree.GetSelections()
        root = self._tree.GetRootItem()
        ret_val = list()
        for id in treeIds:
            start = id
            atoms = [id]
            while self._tree.GetItemParent(start) != root:
                atoms.append(self._tree.GetItemParent(start))
                start = atoms[-1]
            atoms.reverse()
            path = list()
            for atom in atoms:
                path.append(self._tree.GetItemText(atom))

            if wx.Platform == '__WXMSW__':
                r_txt = u''
            else:
                if path[0] != "/":
                    path.pop(0)
                r_txt = os.path.sep

            ret_val.append(r_txt + util.GetPathChar().join(path))
        return ret_val
示例#4
0
    def __GetArtPath(self, client, mime=False):
        """Gets the path of the resource directory to get
        the bitmaps from.
        @return: path of art resource
        @rtype: string

        """
        clients = {wx.ART_MENU: u"menu", wx.ART_TOOLBAR: u"toolbar"}
        if ed_glob.CONFIG['THEME_DIR'] == u'':
            theme = util.ResolvConfigDir(os.path.join("pixmaps", "theme"))
            ed_glob.CONFIG['THEME_DIR'] = theme

        if mime:
            path = ed_glob.CONFIG['THEME_DIR'] + util.GetPathChar() + \
                   Profile_Get('ICONS') + util.GetPathChar() + \
                   u'mime' + util.GetPathChar()
        else:
            path = ed_glob.CONFIG['THEME_DIR'] + util.GetPathChar() + \
                   Profile_Get('ICONS') + util.GetPathChar() + \
                   clients.get(client, u"menu") + util.GetPathChar()

        if os.path.exists(path):
            return path
        else:
            return None
示例#5
0
 def DownloadUpdates(self, dl_loc=wx.EmptyString):
     """Downloads available updates and configures the bar.
     Returns True if the update was successfull or False if
     it was not. The updates will be downloaded to the 
     specified location or to the Users Desktop or Home
     Folder if no location is specified.
     @keyword dl_loc: location to download file to
     
     """
     self.LOG("[updateprog][evt] Attempting to download updates...")
     if dl_loc == wx.EmptyString:
         dl_loc = wx.GetHomeDir() + util.GetPathChar()
         if os.path.exists(dl_loc + u"Desktop"):
             dl_loc = dl_loc + u"Desktop" + util.GetPathChar()
     self._mode = self.ID_DOWNLOADING
     self.SetValue(0)
     self.Start(50)  #XXX Try this for starters
     self._downloading = True  # Mark the work status as busy
     delayedresult.startWorker(self._ResultNotifier,
                               self._DownloadThread,
                               wargs=dl_loc,
                               jobID=self.ID_DOWNLOADING)
示例#6
0
    def __init__(self, parent, id_num):
        """Initialize a notebook with a blank text control in it
        @param parent: parent window of the notebook
        @param id_num: this notebooks id

        """
        FNB.FlatNotebook.__init__(
            self,
            parent,
            id_num,
            style=FNB.FNB_FF2 | FNB.FNB_X_ON_TAB | FNB.FNB_SMART_TABS
            | FNB.FNB_BACKGROUND_GRADIENT | FNB.FNB_DROPDOWN_TABS_LIST
            | FNB.FNB_ALLOW_FOREIGN_DND)

        # Notebook attributes
        self.LOG = wx.GetApp().GetLog()
        self.FindService = ed_search.TextFinder(self, self.GetCurrentCtrl)
        self.DocMgr = doctools.DocPositionMgr(ed_glob.CONFIG['CACHE_DIR'] + \
                                              util.GetPathChar() + u'positions')
        self.pg_num = -1  # Track new pages (aka untitled docs)
        self.control = None
        self.frame = self.GetTopLevelParent()  # MainWindow
        self._index = dict()  # image list index

        # Set Additional Style Parameters
        self.SetNonActiveTabTextColour(wx.Colour(102, 102, 102))
        ed_icon = ed_glob.CONFIG['SYSPIX_DIR'] + u"editra.png"
        self.SetNavigatorIcon(wx.Bitmap(ed_icon, wx.BITMAP_TYPE_PNG))

        # Setup the ImageList and the default image
        imgl = wx.ImageList(16, 16)
        txtbmp = wx.ArtProvider.GetBitmap(str(synglob.ID_LANG_TXT),
                                          wx.ART_MENU)
        self._index[synglob.ID_LANG_TXT] = imgl.Add(txtbmp)
        self.SetImageList(imgl)

        # Notebook Events
        self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGING, self.OnPageChanging)
        self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
        self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnPageClosing)
        self.Bind(FNB.EVT_FLATNOTEBOOK_PAGE_CLOSED, self.OnPageClosed)
        self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnUpdatePageText)
        self._pages.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        # Add a blank page
        self.NewPage()