Ejemplo n.º 1
0
def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    if 'django' in projectname:
        menus.extend([ (None,
            [
                (500, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (530, 'IDPM_DJANGO_INSTALLSYSAPP', tr('Install Contribute Application'), wx.ITEM_NORMAL, '', ''),
                (540, 'IDPM_DJANGO_COMMAND', tr('Django &Command'), wx.ITEM_NORMAL, '', ''),
            ]),
            ('IDPM_DJANGO_INSTALLSYSAPP',
            [
                (100, 'IDPM_DJANGO_INSTALLSYSAPP_ADMIN', tr('Install Admin'), wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
            ]),
            ('IDPM_DJANGO_COMMAND',
            [
                (100, 'IDPM_DJANGO_STARTAPP', tr('Create &New Application'), wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                (110, 'IDPM_DJANGO_RUNSERVER', tr('Start &Developing Server'), wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                (120, 'IDPM_DJANGO_RUNSHELL', tr('Start &Shell'), wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                (130, 'IDPM_DJANGO_DOT', tr('Create &Dot'), wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
            ]),
        ])
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        if os.path.isdir(dir) and os.path.exists(os.path.join(os.path.dirname(dir), '_project')):
            menus.extend([ (None,
            [
                (520, 'IDPM_DJANGO_INSTALLAPP', tr('Install Application'), wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
            ]),
        ])
Ejemplo n.º 2
0
def git_after_addpath(dirwin, item):
    from modules import common
    from modules import Casing
    from Git import Git

    def walk(dirwin, item, dir, files):
        
        if files is None:
            files = {}
            for flag, filename in repo.status_files():
                files[filename] = flag

        dir = os.path.normpath(dir).replace('\\', '/')
        if dir == '.':
            dir = ''
        if dirwin.isFile(item):
            path = dirwin.get_node_filename(item)
            filename = os.path.join(dir, dirwin.tree.GetItemText(item)).replace('\\', '/')
            f = files.get(filename, ' ')
            img_index = dirwin.get_file_image(filename)
            new_img_index = git_get_fix_imgindex(img_index, f)
            old_img_index = dirwin.tree.GetItemImage(item)
            if new_img_index != old_img_index:
                git_set_image(dirwin.tree, item, new_img_index, wx.TreeItemIcon_Normal)
            return
        else:
            if dirwin.tree.GetChildrenCount(item) == 0 and not dirwin.tree.IsExpanded(item):
                return
        path = common.getCurrentDir(dirwin.get_node_filename(item))
        node, cookie = dirwin.tree.GetFirstChild(item)
        while dirwin.is_ok(node):
            filename = os.path.join(dir, dirwin.tree.GetItemText(node)).replace('\\', '/')
            if not dirwin.isFile(node):
                filename = filename + '/'
            f = files.get(filename, ' ')
            if dirwin.isFile(node):
                img_index = dirwin.get_file_image(filename)
                new_img_index = git_get_fix_imgindex(img_index, f)
                old_img_index = dirwin.tree.GetItemImage(node)
                if new_img_index != old_img_index:
                    git_set_image(dirwin.tree, node, new_img_index, wx.TreeItemIcon_Normal)
            else:
                img_index = (dirwin.close_image, dirwin.open_image)
                new_img_index = (git_get_fix_imgindex(dirwin.close_image, f),
                    git_get_fix_imgindex(dirwin.open_image, f))
                old_img_index = dirwin.tree.GetItemImage(node)
                if old_img_index not in new_img_index:
                    git_set_image(dirwin.tree, node, new_img_index[1], wx.TreeItemIcon_Expanded)
                    git_set_image(dirwin.tree, node, new_img_index[0], wx.TreeItemIcon_Normal)
                if dirwin.tree.GetChildrenCount(node) > 0:
                    walk(dirwin, node, os.path.join(dir, filename), files)
            node, cookie = dirwin.tree.GetNextChild(item, cookie)

    path = common.getCurrentDir(dirwin.get_node_filename(item))
    repo_path = detect_git(path)
    if repo_path:
        repo = Git(path)
        d = Casing.Casing(walk, dirwin, item, os.path.relpath(path, repo_path), None)
        d.start_thread()
Ejemplo n.º 3
0
 def OnSearchDir(self, event):
     item = self.tree.GetSelection()
     if not self.is_ok(item): return
     filename = self.get_node_filename(item)
     dir = common.getCurrentDir(filename)
     p = self.mainframe.createFindInFilesWindow()
     self.mainframe.panel.showPage(p)
     page = self.mainframe.panel.getPage(p)
     page.reset(dir)
Ejemplo n.º 4
0
 def OnSearchDir(self, event):
     item = self.tree.GetSelection()
     if not self.is_ok(item): return
     filename = self.get_node_filename(item)
     dir = common.getCurrentDir(filename)
     p = self.mainframe.createFindInFilesWindow()
     self.mainframe.panel.showPage(p)
     page = self.mainframe.panel.getPage(p)
     page.reset(dir)
Ejemplo n.º 5
0
    def walk(dirwin, item, dir, files):

        if files is None:
            files = {}
            for flag, filename in repo.status_files():
                files[filename] = flag

        dir = os.path.normpath(dir).replace('\\', '/')
        if dir == '.':
            dir = ''
        if dirwin.isFile(item):
            path = dirwin.get_node_filename(item)
            filename = os.path.join(dir,
                                    dirwin.tree.GetItemText(item)).replace(
                                        '\\', '/')
            f = files.get(filename, ' ')
            img_index = dirwin.get_file_image(filename)
            new_img_index = git_get_fix_imgindex(img_index, f)
            old_img_index = dirwin.tree.GetItemImage(item)
            if new_img_index != old_img_index:
                git_set_image(dirwin.tree, item, new_img_index,
                              wx.TreeItemIcon_Normal)
            return
        else:
            if dirwin.tree.GetChildrenCount(
                    item) == 0 and not dirwin.tree.IsExpanded(item):
                return
        path = common.getCurrentDir(dirwin.get_node_filename(item))
        node, cookie = dirwin.tree.GetFirstChild(item)
        while dirwin.is_ok(node):
            filename = os.path.join(dir,
                                    dirwin.tree.GetItemText(node)).replace(
                                        '\\', '/')
            if not dirwin.isFile(node):
                filename = filename + '/'
            f = files.get(filename, ' ')
            if dirwin.isFile(node):
                img_index = dirwin.get_file_image(filename)
                new_img_index = git_get_fix_imgindex(img_index, f)
                old_img_index = dirwin.tree.GetItemImage(node)
                if new_img_index != old_img_index:
                    git_set_image(dirwin.tree, node, new_img_index,
                                  wx.TreeItemIcon_Normal)
            else:
                img_index = (dirwin.close_image, dirwin.open_image)
                new_img_index = (git_get_fix_imgindex(dirwin.close_image, f),
                                 git_get_fix_imgindex(dirwin.open_image, f))
                old_img_index = dirwin.tree.GetItemImage(node)
                if old_img_index not in new_img_index:
                    git_set_image(dirwin.tree, node, new_img_index[1],
                                  wx.TreeItemIcon_Expanded)
                    git_set_image(dirwin.tree, node, new_img_index[0],
                                  wx.TreeItemIcon_Normal)
                if dirwin.tree.GetChildrenCount(node) > 0:
                    walk(dirwin, node, os.path.join(dir, filename), files)
            node, cookie = dirwin.tree.GetNextChild(item, cookie)
Ejemplo n.º 6
0
def after_addpath(dirwin, item):
    from modules import common
    import SvnSupport as vc
    from modules import Casing

    def walk(dirwin, item):
#        svn_lock.acquire()
#        try:
        if dirwin.isFile(item):
            path = dirwin.get_node_filename(item)
            entries = vc.get_entries(path)
            filename = dirwin.tree.GetItemText(item)
            f = entries.get(filename, '')
            img_index = dirwin.get_file_image(filename)
            new_img_index = get_fix_imgindex(img_index, f)
            old_img_index = dirwin.tree.GetItemImage(item)
            if new_img_index != old_img_index:
                set_image(dirwin.tree, item, new_img_index, wx.TreeItemIcon_Normal)
            return
        else:
            if dirwin.tree.GetChildrenCount(item) == 0 and not dirwin.tree.IsExpanded(item):
                return
        path = common.getCurrentDir(dirwin.get_node_filename(item))
        entries = vc.get_entries(path)
        node, cookie = dirwin.tree.GetFirstChild(item)
        while dirwin.is_ok(node):
            filename = dirwin.tree.GetItemText(node)
            f = entries.get(filename, ' ')
            if dirwin.isFile(node):
                img_index = dirwin.get_file_image(filename)
                new_img_index = get_fix_imgindex(img_index, f)
                old_img_index = dirwin.tree.GetItemImage(node)
                if new_img_index != old_img_index:
                    set_image(dirwin.tree, node, new_img_index, wx.TreeItemIcon_Normal)
            else:
                img_index = (dirwin.close_image, dirwin.open_image)
                new_img_index = (get_fix_imgindex(dirwin.close_image, f),
                    get_fix_imgindex(dirwin.open_image, f))
                old_img_index = dirwin.tree.GetItemImage(node)
                if old_img_index not in new_img_index:
                    set_image(dirwin.tree, node, new_img_index[1], wx.TreeItemIcon_Expanded)
                    set_image(dirwin.tree, node, new_img_index[0], wx.TreeItemIcon_Normal)
                if dirwin.tree.GetChildrenCount(node) > 0:
                    walk(dirwin, node)
            node, cookie = dirwin.tree.GetNextChild(item, cookie)
#        finally:
#            svn_lock.release()

    is_svn_dir = detect_svn(common.getCurrentDir(dirwin.get_node_filename(item)))

    if is_svn_dir:
        d = Casing.Casing(walk, dirwin, item)
        d.start_thread()
Ejemplo n.º 7
0
def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not dirwin.is_ok(item):
        is_svn_dir = False
    else:
        is_svn_dir = detect_svn(
            common.getCurrentDir(dirwin.get_node_filename(item)))
    menus.extend([
        (None, [
            (93.0, 'IDPM_VC_CHECKOUT', tr('SVN Checkout'), wx.ITEM_NORMAL,
             'OnVC_DoCommand', ''),
            (93.3, 'IDPM_VC_COMMANDS', tr('SVN Commands'), wx.ITEM_NORMAL, '',
             ''),
            (93.4, '', '-', wx.ITEM_SEPARATOR, None, ''),
        ]),
        ('IDPM_VC_COMMANDS', [
            (900, 'IDPM_VC_COMMANDS_SETTINGS', tr('Settings...'),
             wx.ITEM_NORMAL, 'OnVC_Settings', ''),
        ]),
    ])

    if is_svn_dir:
        menus.extend([
            (None, [
                (93.1, 'IDPM_VC_UPDATE', tr('SVN Update'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (93.2, 'IDPM_VC_COMMIT', tr('SVN Commit'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
            ]),
            ('IDPM_VC_COMMANDS', [
                (100, 'IDPM_VC_COMMANDS_LIST', tr('&List'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (110, 'IDPM_VC_COMMANDS_SHOWLOG', tr('Show l&og'),
                 wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (120, 'IDPM_VC_COMMANDS_STATUS', tr('&Status'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (130, 'IDPM_VC_COMMANDS_DIFF', tr('Di&ff'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (145, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (150, 'IDPM_VC_COMMANDS_ADD', tr('&Add'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (160, 'IDPM_VC_COMMANDS_RENAME', tr('&Rename'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (170, 'IDPM_VC_COMMANDS_DELETE', tr('&Delete'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (180, 'IDPM_VC_COMMANDS_REVERSE', tr('Re&vert'),
                 wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (190, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (200, 'IDPM_VC_COMMANDS_EXPORT', tr('&Export'), wx.ITEM_NORMAL,
                 'OnVC_DoCommand', ''),
                (210, '', '-', wx.ITEM_SEPARATOR, None, ''),
            ]),
        ])
Ejemplo n.º 8
0
def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    if 'web2py' in projectname:
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        basedir = os.path.basename(os.path.dirname(dir))
        if os.path.isdir(dir) and basedir == 'applications':
            menus.extend([ (None,
            [
                (500, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (520, 'IDPM_WEB2PY_SHELL', tr('Start web2py Shell'), wx.ITEM_NORMAL, 'OnWeb2pyShell', ''),
            ]),
        ])
Ejemplo n.º 9
0
def OnWeb2pyShell(dirwin, event):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return

    win = Globals.mainframe
    dir = common.getCurrentDir(dirwin.get_node_filename(item))
    appname = os.path.basename(dir)
    pagename = tr('web2py Shell') + ' [%s]' % appname
    
    page = win.panel.getPage(pagename)
    if not page:
        from web2py_shell import Web2pyShell
        page = Web2pyShell(win.panel.createNotebook('bottom'), win)
        win.panel.addPage('bottom', page, pagename)
    win.panel.showPage(pagename)
    page.set_locals(dir, appname)
Ejemplo n.º 10
0
 def walk(dirwin, item):
     #        svn_lock.acquire()
     #        try:
     if dirwin.isFile(item):
         path = dirwin.get_node_filename(item)
         entries = vc.get_entries(path)
         filename = dirwin.tree.GetItemText(item)
         f = entries.get(filename, '')
         img_index = dirwin.get_file_image(filename)
         new_img_index = get_fix_imgindex(img_index, f)
         old_img_index = dirwin.tree.GetItemImage(item)
         if new_img_index != old_img_index:
             set_image(dirwin.tree, item, new_img_index,
                       wx.TreeItemIcon_Normal)
         return
     else:
         if dirwin.tree.GetChildrenCount(
                 item) == 0 and not dirwin.tree.IsExpanded(item):
             return
     path = common.getCurrentDir(dirwin.get_node_filename(item))
     entries = vc.get_entries(path)
     node, cookie = dirwin.tree.GetFirstChild(item)
     while dirwin.is_ok(node):
         filename = dirwin.tree.GetItemText(node)
         f = entries.get(filename, '')
         if dirwin.isFile(node):
             img_index = dirwin.get_file_image(filename)
             new_img_index = get_fix_imgindex(img_index, f)
             old_img_index = dirwin.tree.GetItemImage(node)
             if new_img_index != old_img_index:
                 set_image(dirwin.tree, node, new_img_index,
                           wx.TreeItemIcon_Normal)
         else:
             img_index = (dirwin.close_image, dirwin.open_image)
             new_img_index = (get_fix_imgindex(dirwin.close_image, f),
                              get_fix_imgindex(dirwin.open_image, f))
             old_img_index = dirwin.tree.GetItemImage(node)
             if old_img_index not in new_img_index:
                 set_image(dirwin.tree, node, new_img_index[1],
                           wx.TreeItemIcon_Expanded)
                 set_image(dirwin.tree, node, new_img_index[0],
                           wx.TreeItemIcon_Normal)
             if dirwin.tree.GetChildrenCount(node) > 0:
                 walk(dirwin, node)
         node, cookie = dirwin.tree.GetNextChild(item, cookie)
Ejemplo n.º 11
0
def OnCreatePythonPackage(dirwin, event):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    dir = common.getCurrentDir(dirwin.get_node_filename(item))
    
    from modules import Entry
    dlg = Entry.MyTextEntry(Globals.mainframe, tr('Input Directory Name'),
        tr('Input Directory Name'))
    path = ''
    if dlg.ShowModal() == wx.ID_OK:
        path = dlg.GetValue()
    dlg.Destroy()
    
    path = os.path.join(dir, path)
    if not os.path.exists(path):
        try:
            os.makedirs(path)
        except Exception, e:
            common.showerror(str(e))
Ejemplo n.º 12
0
def OnCreatePythonPackage(dirwin, event):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    dir = common.getCurrentDir(dirwin.get_node_filename(item))

    from modules import Entry
    dlg = Entry.MyTextEntry(Globals.mainframe, tr('Input Directory Name'),
                            tr('Input Directory Name'))
    path = ''
    if dlg.ShowModal() == wx.ID_OK:
        path = dlg.GetValue()
    dlg.Destroy()

    path = os.path.join(dir, path)
    if not os.path.exists(path):
        try:
            os.makedirs(path)
        except Exception, e:
            common.showerror(str(e))
Ejemplo n.º 13
0
    def walk(dirwin, item):
#        svn_lock.acquire()
#        try:
        if dirwin.isFile(item):
            path = dirwin.get_node_filename(item)
            entries = vc.get_entries(path)
            filename = dirwin.tree.GetItemText(item)
            f = entries.get(filename, '')
            img_index = dirwin.get_file_image(filename)
            new_img_index = get_fix_imgindex(img_index, f)
            old_img_index = dirwin.tree.GetItemImage(item)
            if new_img_index != old_img_index:
                set_image(dirwin.tree, item, new_img_index, wx.TreeItemIcon_Normal)
            return
        else:
            if dirwin.tree.GetChildrenCount(item) == 0 and not dirwin.tree.IsExpanded(item):
                return
        path = common.getCurrentDir(dirwin.get_node_filename(item))
        entries = vc.get_entries(path)
        node, cookie = dirwin.tree.GetFirstChild(item)
        while dirwin.is_ok(node):
            filename = dirwin.tree.GetItemText(node)
            f = entries.get(filename, ' ')
            if dirwin.isFile(node):
                img_index = dirwin.get_file_image(filename)
                new_img_index = get_fix_imgindex(img_index, f)
                old_img_index = dirwin.tree.GetItemImage(node)
                if new_img_index != old_img_index:
                    set_image(dirwin.tree, node, new_img_index, wx.TreeItemIcon_Normal)
            else:
                img_index = (dirwin.close_image, dirwin.open_image)
                new_img_index = (get_fix_imgindex(dirwin.close_image, f),
                    get_fix_imgindex(dirwin.open_image, f))
                old_img_index = dirwin.tree.GetItemImage(node)
                if old_img_index not in new_img_index:
                    set_image(dirwin.tree, node, new_img_index[1], wx.TreeItemIcon_Expanded)
                    set_image(dirwin.tree, node, new_img_index[0], wx.TreeItemIcon_Normal)
                if dirwin.tree.GetChildrenCount(node) > 0:
                    walk(dirwin, node)
            node, cookie = dirwin.tree.GetNextChild(item, cookie)
Ejemplo n.º 14
0
def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not dirwin.is_ok(item):
        is_svn_dir = False
    else:
        is_svn_dir = detect_svn(common.getCurrentDir(dirwin.get_node_filename(item)))
    menus.extend([ (None,
        [
            (93.0, 'IDPM_VC_CHECKOUT', tr('SVN Checkout'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
            (93.3, 'IDPM_VC_COMMANDS', tr('SVN Commands'), wx.ITEM_NORMAL, '', ''),
            (93.4, '', '-', wx.ITEM_SEPARATOR, None, ''),
        ]),
        ('IDPM_VC_COMMANDS',
        [
            (900, 'IDPM_VC_COMMANDS_SETTINGS', tr('Settings...'), wx.ITEM_NORMAL, 'OnVC_Settings', ''),
        ]),
    ])

    if is_svn_dir:
        menus.extend([ (None,
            [
                (93.1, 'IDPM_VC_UPDATE', tr('SVN Update'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (93.2, 'IDPM_VC_COMMIT', tr('SVN Commit'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
            ]),
            ('IDPM_VC_COMMANDS',
            [
                (100, 'IDPM_VC_COMMANDS_LIST', tr('&List'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (110, 'IDPM_VC_COMMANDS_SHOWLOG', tr('Show l&og'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (120, 'IDPM_VC_COMMANDS_STATUS', tr('&Status'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (130, 'IDPM_VC_COMMANDS_DIFF', tr('Di&ff'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (145, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (150, 'IDPM_VC_COMMANDS_ADD', tr('&Add'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (160, 'IDPM_VC_COMMANDS_RENAME', tr('&Rename'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (170, 'IDPM_VC_COMMANDS_DELETE', tr('&Delete'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (180, 'IDPM_VC_COMMANDS_REVERSE', tr('Re&vert'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (190, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (200, 'IDPM_VC_COMMANDS_EXPORT', tr('&Export'), wx.ITEM_NORMAL, 'OnVC_DoCommand', ''),
                (210, '', '-', wx.ITEM_SEPARATOR, None, ''),
            ]),
        ])
Ejemplo n.º 15
0
    def refresh(self, item, first=True):
        cur_item = item
        if self.isFile(cur_item):
            item = self.tree.GetItemParent(cur_item)
        else:
            if self.tree.GetChildrenCount(
                    cur_item) == 0 and not self.tree.IsExpanded(cur_item):
                return
        path = common.getCurrentDir(self.get_node_filename(item))
        dirs, files = self.get_files(path)
        node, cookie = self.tree.GetFirstChild(item)
        delnodes = []
        while self.is_ok(node):
            filename = self.tree.GetItemText(node)
            if self.isFile(node):
                if filename in files:
                    files.remove(filename)
                else:
                    delnodes.append(node)
            else:
                if filename in dirs:
                    dirs.remove(filename)
                    if self.tree.GetChildrenCount(node) > 0:
                        self.refresh(node, False)
                else:
                    delnodes.append(node)
            node, cookie = self.tree.GetNextChild(item, cookie)

        for node in delnodes:
            self.tree.Delete(node)

        #add rest dirs and files
        for filename in dirs:
            self.insert_filename_node(item, path, filename, False)
        for filename in files:
            self.insert_filename_node(item, path, filename, True)

        if first:
            self.callplugin('after_refresh', self, item)
Ejemplo n.º 16
0
    def refresh(self, item, first=True):
        cur_item = item
        if self.isFile(cur_item):
            item = self.tree.GetItemParent(cur_item)
        else:
            if self.tree.GetChildrenCount(cur_item) == 0 and not self.tree.IsExpanded(cur_item):
                return
        path = common.getCurrentDir(self.get_node_filename(item))
        dirs, files = self.get_files(path)
        node, cookie = self.tree.GetFirstChild(item)
        delnodes = []
        while self.is_ok(node):
            filename = self.tree.GetItemText(node)
            if self.isFile(node):
                if filename in files:
                    files.remove(filename)
                else:
                    delnodes.append(node)
            else:
                if filename in dirs:
                    dirs.remove(filename)
                    if self.tree.GetChildrenCount(node) > 0:
                        self.refresh(node, False)
                else:
                    delnodes.append(node)
            node, cookie = self.tree.GetNextChild(item, cookie)

        for node in delnodes:
            self.tree.Delete(node)

        #add rest dirs and files
        for filename in dirs:
            self.insert_filename_node(item, path, filename, False)
        for filename in files:
            self.insert_filename_node(item, path, filename, True)

        if first:
            self.callplugin('after_refresh', self, item)
Ejemplo n.º 17
0
def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    if 'django' in projectname:
        menus.extend([
            (None, [
                (500, '', '-', wx.ITEM_SEPARATOR, None, ''),
                (530, 'IDPM_DJANGO_INSTALLSYSAPP',
                 tr('Install Contribute Application'), wx.ITEM_NORMAL, '', ''),
                (540, 'IDPM_DJANGO_COMMAND', tr('Django &Command'),
                 wx.ITEM_NORMAL, '', ''),
            ]),
            ('IDPM_DJANGO_INSTALLSYSAPP', [
                (100, 'IDPM_DJANGO_INSTALLSYSAPP_ADMIN', tr('Install Admin'),
                 wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
            ]),
            ('IDPM_DJANGO_COMMAND', [
                (100, 'IDPM_DJANGO_STARTAPP', tr('Create &New Application'),
                 wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                (110, 'IDPM_DJANGO_RUNSERVER', tr('Start &Developing Server'),
                 wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                (120, 'IDPM_DJANGO_RUNSHELL', tr('Start &Shell'),
                 wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                (130, 'IDPM_DJANGO_DOT', tr('Create &Dot'), wx.ITEM_NORMAL,
                 'OnDjangoFunc', ''),
            ]),
        ])
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        if os.path.isdir(dir) and os.path.exists(
                os.path.join(os.path.dirname(dir), '_project')):
            menus.extend([
                (None, [
                    (520, 'IDPM_DJANGO_INSTALLAPP', tr('Install Application'),
                     wx.ITEM_NORMAL, 'OnDjangoFunc', ''),
                ]),
            ])
Ejemplo n.º 18
0
def other_popup_menu(dirwin, projectname, menus):
    item = dirwin.tree.GetSelection()
    if not item.IsOk():
        return
    if "django" in projectname:
        menus.extend(
            [
                (
                    None,
                    [
                        (500, "", "-", wx.ITEM_SEPARATOR, None, ""),
                        (
                            530,
                            "IDPM_DJANGO_INSTALLSYSAPP",
                            tr("Install Contribute Application"),
                            wx.ITEM_NORMAL,
                            "",
                            "",
                        ),
                        (540, "IDPM_DJANGO_COMMAND", tr("Django &Command"), wx.ITEM_NORMAL, "", ""),
                    ],
                ),
                (
                    "IDPM_DJANGO_INSTALLSYSAPP",
                    [(100, "IDPM_DJANGO_INSTALLSYSAPP_ADMIN", tr("Install Admin"), wx.ITEM_NORMAL, "OnDjangoFunc", "")],
                ),
                (
                    "IDPM_DJANGO_COMMAND",
                    [
                        (
                            100,
                            "IDPM_DJANGO_STARTAPP",
                            tr("Create &New Application"),
                            wx.ITEM_NORMAL,
                            "OnDjangoFunc",
                            "",
                        ),
                        (
                            110,
                            "IDPM_DJANGO_RUNSERVER",
                            tr("Start &Developing Server"),
                            wx.ITEM_NORMAL,
                            "OnDjangoFunc",
                            "",
                        ),
                        (120, "IDPM_DJANGO_RUNSHELL", tr("Start &Shell"), wx.ITEM_NORMAL, "OnDjangoFunc", ""),
                        (130, "IDPM_DJANGO_DOT", tr("Create &Dot"), wx.ITEM_NORMAL, "OnDjangoFunc", ""),
                    ],
                ),
            ]
        )
        dir = common.getCurrentDir(dirwin.get_node_filename(item))
        if os.path.isdir(dir) and os.path.exists(os.path.join(os.path.dirname(dir), "_project")):
            menus.extend(
                [
                    (
                        None,
                        [
                            (
                                520,
                                "IDPM_DJANGO_INSTALLAPP",
                                tr("Install Application"),
                                wx.ITEM_NORMAL,
                                "OnDjangoFunc",
                                "",
                            )
                        ],
                    )
                ]
            )
Ejemplo n.º 19
0
 def OnExplorerWindow(self, event):
     item = self.tree.GetSelection()
     if not self.is_ok(item): return
     filename = self.get_node_filename(item)
     dir = common.getCurrentDir(filename)
     wx.Execute(r"explorer.exe /e, %s" % dir)
Ejemplo n.º 20
0
 def OnExplorerWindow(self, event):
     item = self.tree.GetSelection()
     if not self.is_ok(item): return
     filename = self.get_node_filename(item)
     dir = common.getCurrentDir(filename)
     wx.Execute(r"explorer.exe /e, %s" % dir)
Ejemplo n.º 21
0
def after_addpath(dirwin, item):
    from modules import common
    import SvnSupport as vc
    from modules import Casing

    def walk(dirwin, item):
        #        svn_lock.acquire()
        #        try:
        if dirwin.isFile(item):
            path = dirwin.get_node_filename(item)
            entries = vc.get_entries(path)
            filename = dirwin.tree.GetItemText(item)
            f = entries.get(filename, '')
            img_index = dirwin.get_file_image(filename)
            new_img_index = get_fix_imgindex(img_index, f)
            old_img_index = dirwin.tree.GetItemImage(item)
            if new_img_index != old_img_index:
                set_image(dirwin.tree, item, new_img_index,
                          wx.TreeItemIcon_Normal)
            return
        else:
            if dirwin.tree.GetChildrenCount(
                    item) == 0 and not dirwin.tree.IsExpanded(item):
                return
        path = common.getCurrentDir(dirwin.get_node_filename(item))
        entries = vc.get_entries(path)
        node, cookie = dirwin.tree.GetFirstChild(item)
        while dirwin.is_ok(node):
            filename = dirwin.tree.GetItemText(node)
            f = entries.get(filename, ' ')
            if dirwin.isFile(node):
                img_index = dirwin.get_file_image(filename)
                new_img_index = get_fix_imgindex(img_index, f)
                old_img_index = dirwin.tree.GetItemImage(node)
                if new_img_index != old_img_index:
                    set_image(dirwin.tree, node, new_img_index,
                              wx.TreeItemIcon_Normal)
            else:
                img_index = (dirwin.close_image, dirwin.open_image)
                new_img_index = (get_fix_imgindex(dirwin.close_image, f),
                                 get_fix_imgindex(dirwin.open_image, f))
                old_img_index = dirwin.tree.GetItemImage(node)
                if old_img_index not in new_img_index:
                    set_image(dirwin.tree, node, new_img_index[1],
                              wx.TreeItemIcon_Expanded)
                    set_image(dirwin.tree, node, new_img_index[0],
                              wx.TreeItemIcon_Normal)
                if dirwin.tree.GetChildrenCount(node) > 0:
                    walk(dirwin, node)
            node, cookie = dirwin.tree.GetNextChild(item, cookie)


#        finally:
#            svn_lock.release()

    is_svn_dir = detect_svn(
        common.getCurrentDir(dirwin.get_node_filename(item)))

    if is_svn_dir:
        d = Casing.Casing(walk, dirwin, item)
        d.start_thread()