Ejemplo n.º 1
0
 def _itemActive(self, ev):
     items = autil.list_get_selectitems(self._list)
     for item in items:
         name = self._list.GetItem(item, col_name).GetText()
         thd = self._task_thread[name]
         if thd.isAlive():
             thd._active_event.set()
Ejemplo n.º 2
0
    def _listRightclick(self, ev):
        selcnt = self._list.GetSelectedItemCount()
        if selcnt < 1:
            menu = autil.new_menubar(self,
                                     [{u'同步': self._itemSync}])
            if 'clipfiles' in self.__dict__:
                item = menu.Append(wx.ID_ANY, u'粘贴')
                menu.Bind(wx.EVT_MENU, self._itemPaste, item)

            self._list.PopupMenu(menu, wx.DefaultPosition)
            return

        menu = autil.new_menubar(self,
                                 [{u'下载': self._itemDownload},
                                  {u'复制': self._itemCopy},
                                  {u'剪切': self._itemCut},
                                  {u'删除': self._itemDelete}])
        if selcnt == 1:
            item = menu.Append(wx.ID_ANY, u'重命名')
            menu.Bind(wx.EVT_MENU, self._itemRename, item)
            ids = autil.list_get_selectitems(self._list)
            filetype = self._list.GetItemData(ids[0])
            if filetype == type_folder:
                item = menu.Append(wx.ID_ANY, u'同步')
                menu.Bind(wx.EVT_MENU, self._itemSync, item)
                if 'clipfiles' in self.__dict__:
                    item = menu.Append(wx.ID_ANY, u'粘贴')
                    menu.Bind(wx.EVT_MENU, self._itemPaste, item)

        self._list.PopupMenu(menu, wx.DefaultPosition)
Ejemplo n.º 3
0
    def _ui_item_delete(self, ev):
        items = autil.list_get_selectitems(self._list)
        ids = []
        items.reverse()
        for x in items:
            taskid = self._list.GetItemData(x)
            ids.append(taskid)
            self._list.DeleteItem(x)

        self.remove(ids)
Ejemplo n.º 4
0
    def _itemDelete(self, ev):
        items = autil.list_get_selectitems(self._list)
        items.reverse()
        for item in items:
            name = self._list.GetItem(item, col_name).GetText()
            self._stopTask(name)
            del self.itemDataMap[name]
            local = self._list.GetItem(item, col_local).GetText()
            path = os.path.join(os.path.expanduser('~'), '.alyc.cache', 'sync',
                                local.replace(os.sep, '-'))
            shutil.rmtree(path)

        self._dump()
        self._showDataMap()
Ejemplo n.º 5
0
    def get_selectfiles(self):
        items = autil.list_get_selectitems(self._list)
        files = []
        for item in items:
            itemtext = self._list.GetItemText(item)
            if itemtext == '..':
                path = yun.sep.join(self.path.GetValue().split(yun.sep)[:-1])
            else:
                path = yun.sep.join([self.path.GetValue(),
                                     self._list.GetItemText(item)])

            isdir = self._list.GetItemData(item)
            files.append({path: isdir})

        return files