示例#1
0
 def paste_clipboard(self):
     newname = os.path.join(self.path, os.path.basename(self._clipboard_file))
     if newname == self._clipboard_file:
         self.svc.error_dlg(_('Cannot copy files to themselves.'))
         return
     if not os.path.exists(self._clipboard_file):
         self.svc.error_dlg(_('Source file has vanished.'))
         return
     if os.path.exists(newname):
         self.svc.error_dlg(_('Destination already exists.'))
         return
     
     task = AsyncTask(self._paste_clipboard, lambda: None)
     task.start()
示例#2
0
    def paste_clipboard(self):
        newname = os.path.join(self.path,
                               os.path.basename(self._clipboard_file))
        if newname == self._clipboard_file:
            self.svc.error_dlg(_('Cannot copy files to themselves.'))
            return
        if not os.path.exists(self._clipboard_file):
            self.svc.error_dlg(_('Source file has vanished.'))
            return
        if os.path.exists(newname):
            self.svc.error_dlg(_('Destination already exists.'))
            return

        task = AsyncTask(self._paste_clipboard, lambda: None)
        task.start()
示例#3
0
文件: views.py 项目: fermat618/pida
 def _python_fork(self, commandargs, env, cwd):
     self._term.connect('commit', self.on_commit_python)
     # TODO: Env broken
     env = dict(os.environ)
     env['TERM'] = 'xterm'
     (master, slave) = os.openpty()
     self.slave = slave
     self.master = master
     self._term.set_pty(master)
     p = subprocess.Popen(commandargs, stdin=slave, stdout=slave,
                          preexec_fn=self._python_fork_preexec_fn,
                          stderr=slave, env=env, cwd=cwd, close_fds=True)
     self._pid = p.pid
     self._last_cwd = cwd
     gobject.timeout_add(200, self._save_cwd)
     t = AsyncTask(self._python_fork_waiter, self._python_fork_complete)
     t.start(p)
示例#4
0
文件: web.py 项目: xmonader/pida
    if data:
        urlargs = (req, urlencode(data))
    else:
        urlargs = (req,)

    def _fetcher():
        try:
            f = urlopen(*urlargs)
            content = f.read()
            url = f.url
        except Exception, e:
            content = str(e)
            url = None
        return url, content

    task = AsyncTask(_fetcher, content_callback)
    task.start()

if __name__ == '__main__':
    def cc(url, data):
        print url, data
        gtk.main_quit()

    fetch_url('http://google.com/sdfsdfsdf', cc)
    import gtk
    gtk.threads_init()
    gtk.threads_enter()
    gtk.main()
    gtk.threads_leave()

示例#5
0
文件: library.py 项目: fermat618/pida
 def on_books_list__double_click(self, ol, item):
     self.contents_tree.clear()
     if item is not None:
         task = AsyncTask(self.load_book, self.book_loaded)
         task.start()
示例#6
0
 def remove_path(self, path):
     task = AsyncTask(self._remove_path, lambda: None)
     task.start(path)
示例#7
0
 def create_ancest_tree(self):
     task = AsyncTask(self._get_ancestors, self._show_ancestors)
     task.start(self.path)
示例#8
0
 def diff_path(self, path):
     self._log.append_action('Diffing', path, gtk.STOCK_COPY)
     task = AsyncTask(self._do_diff, self._done_diff)
     task.start(path)
示例#9
0
 def remove_path(self, path):
     task = AsyncTask(self._remove_path, lambda: None)
     task.start(path)
示例#10
0
 def create_ancest_tree(self):
     task = AsyncTask(self._get_ancestors, self._show_ancestors)
     task.start(self.path)