Ejemplo n.º 1
0
def main():
    vfs.init()
    try:
        trash = vfs.Trash.get_default()
        mainloop = gobject.MainLoop()
        trash.connect('file-count-changed', on_file_count_changed, mainloop)
        mainloop.run()
    finally:
        vfs.shutdown()
    return 0
def main():
    vfs.init()
    try:
        trash = vfs.Trash.get_default()
        mainloop = gobject.MainLoop()
        trash.connect('file-count-changed', on_file_count_changed, mainloop)
        mainloop.run()
    finally:
        vfs.shutdown()
    return 0
def main(args):
    if len(args) < 2:
        sys.stderr.write('Usage: %s [FILE | DIRECTORY FILE] \n' % args[0])
        return 1
    vfs.init()
    try:
        ml = gobject.MainLoop()
        test = TestFileMonitor(args[1])
        ml.run()
        test.monitor.cancel()
        assert test.monitor.props.cancelled
    finally:
        vfs.shutdown()
    return 0
Ejemplo n.º 4
0
def main(args):
    if len(args) < 2:
        sys.stderr.write('Usage: %s [FILE | DIRECTORY FILE] \n' % args[0])
        return 1
    vfs.init()
    try:
        ml = gobject.MainLoop()
        test = TestFileMonitor(args[1])
        ml.run()
        test.monitor.cancel()
        assert test.monitor.props.cancelled
    finally:
        vfs.shutdown()
    return 0
def main():
    gtk.init_check()
    vfs.init()
    test_launch = 'launch' in sys.argv
    try:
        path = tempfile.gettempdir()
        tmp = vfs.File.for_path(path)
        assert tmp.props.parent is not None
        assert tmp.exists()
        assert tmp.props.file_type == vfs.FILE_TYPE_DIRECTORY
        assert (tmp.props.access_flags & vfs.ACCESS_FLAGS_READ) != 0
        assert tmp.is_readable()
        assert (tmp.props.access_flags & vfs.ACCESS_FLAGS_WRITE) != 0
        assert tmp.is_writable()
        print 'URI: %s' % tmp.props.uri
        print 'Path: %s' % tmp.props.path
        print '# of files: %d' % len(tmp.enumerate_children())
        file_path = os.path.join(path,
                                 '%s-lda-test' % tempfile.gettempprefix())
        tmp_file = vfs.File.for_path(file_path)
        assert tmp_file.props.parent is not None and \
               tmp_file.props.parent.props.uri == tmp.props.uri
        tmp_file.replace_contents(CONTENT)
        assert tmp_file.load_contents() == CONTENT
        if test_launch:
            assert tmp_file.launch()
        file_copy_path = '%s-copy' % file_path
        file_copy = vfs.File.for_path(file_copy_path)
        assert tmp_file.copy(file_copy, True)
        assert CONTENT == file_copy.load_contents()
        if not test_launch:
            assert file_copy.remove()
            assert not file_copy.exists()
            assert tmp_file.remove()
            assert not tmp_file.exists()
    finally:
        vfs.shutdown()
Ejemplo n.º 6
0
def main():
    gtk.init_check()
    vfs.init()
    test_launch = 'launch' in sys.argv
    try:
        path = tempfile.gettempdir()
        tmp = vfs.File.for_path(path)
        assert tmp.props.parent is not None
        assert tmp.exists()
        assert tmp.props.file_type == vfs.FILE_TYPE_DIRECTORY
        assert (tmp.props.access_flags & vfs.ACCESS_FLAGS_READ) != 0
        assert tmp.is_readable()
        assert (tmp.props.access_flags & vfs.ACCESS_FLAGS_WRITE) != 0
        assert tmp.is_writable()
        print 'URI: %s' % tmp.props.uri
        print 'Path: %s' % tmp.props.path
        print '# of files: %d' % len(tmp.enumerate_children())
        file_path = os.path.join(path,
                                 '%s-lda-test' % tempfile.gettempprefix())
        tmp_file = vfs.File.for_path(file_path)
        assert tmp_file.props.parent is not None and \
               tmp_file.props.parent.props.uri == tmp.props.uri
        tmp_file.replace_contents(CONTENT)
        assert tmp_file.load_contents() == CONTENT
        if test_launch:
            assert tmp_file.launch()
        file_copy_path = '%s-copy' % file_path
        file_copy = vfs.File.for_path(file_copy_path)
        assert tmp_file.copy(file_copy, True)
        assert CONTENT == file_copy.load_contents()
        if not test_launch:
            assert file_copy.remove()
            assert not file_copy.exists()
            assert tmp_file.remove()
            assert not tmp_file.exists()
    finally:
        vfs.shutdown()
Ejemplo n.º 7
0
def main(args):
    vfs.init()
    try:
        if len(args) > 1:
            for arg in args[1:]:
                desktop_file = vfs.File.for_path(arg)
                entry = fdo.DesktopEntry.for_file(desktop_file)
                print 'Entry: %s' % entry.props.name
                print 'Entry exec line: %s', entry.get_string('Exec')
                if entry.exists():
                    pid = entry.launch(0, None)
                    print 'PID: %d' % pid
                else:
                    print 'Entry does not exist!'
        else:
            entry = fdo.DesktopEntry.new()
            entry.props.name = 'hosts file'
            entry.props.entry_type = fdo.DESKTOP_ENTRY_TYPE_LINK
            entry.set_string('URL', 'file:///etc/hosts')
            test_filename = '/tmp/desktop-agnostic-test.desktop'
            desktop_file = vfs.File.for_path(test_filename)
            entry.save(desktop_file)
    finally:
        vfs.shutdown()
def main(args):
    vfs.init()
    try:
        if len(args) > 1:
            for arg in args[1:]:
                desktop_file = vfs.File.for_path(arg)
                entry = fdo.DesktopEntry.for_file(desktop_file)
                print 'Entry: %s' % entry.props.name
                print 'Entry exec line: %s', entry.get_string('Exec')
                if entry.exists():
                    pid = entry.launch(0, None)
                    print 'PID: %d' % pid
                else:
                    print 'Entry does not exist!'
        else:
            entry = fdo.DesktopEntry.new()
            entry.props.name = 'hosts file'
            entry.props.entry_type = fdo.DESKTOP_ENTRY_TYPE_LINK
            entry.set_string('URL', 'file:///etc/hosts')
            test_filename = '/tmp/desktop-agnostic-test.desktop'
            desktop_file = vfs.File.for_path(test_filename)
            entry.save(desktop_file)
    finally:
        vfs.shutdown()
Ejemplo n.º 9
0
            client.unbind_all_for_object(docklet_mouseout)
            client.unbind_all_for_object(album_art_check)
            client.unbind_all_for_object(size_spin)
        window.connect("destroy", lambda x: unbind_all())
        window.show()

    def show_about(self, widget):
        about = gtk.AboutDialog()
        awn_icon = self.get_icon()
        about.set_logo(awn_icon.get_icon_at_size(48))
        about.set_icon(awn_icon.get_icon_at_size(64))
        about.set_name(_("Media Control Applet"))
        about.set_copyright("Copyright (c) 2007 Randal Barlow <im.tehk at gmail.com>")
        about.set_authors(["Randal Barlow <im.tehk at gmail.com>", "Michal Hruby <michal.mhr at gmail.com>"])
        about.set_comments(_("Controls your favourite music player."))
        about.set_license("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.")
        about.set_wrap_license(True)
        about.set_documenters(["Randal Barlow <im.tehk at gmail.com>"])
        about.set_artists(["Claudio Benech"])
        about.run()
        about.destroy()


if __name__ == "__main__":
    awn.init                      (sys.argv[1:])
    vfs.init                      ()
    applet = MediaControlApplet   (awn.uid, awn.panel_id)
    awn.embed_applet              (applet)
    applet.show_all               ()
    gtk.main                      ()
Ejemplo n.º 10
0
    def show_about(self, widget):
        about = gtk.AboutDialog()
        awn_icon = self.get_icon()
        about.set_logo(awn_icon.get_icon_at_size(48))
        about.set_icon(awn_icon.get_icon_at_size(64))
        about.set_name(_("Media Control Applet"))
        about.set_copyright(
            "Copyright (c) 2007 Randal Barlow <im.tehk at gmail.com>")
        about.set_authors([
            "Randal Barlow <im.tehk at gmail.com>",
            "Michal Hruby <michal.mhr at gmail.com>"
        ])
        about.set_comments(_("Controls your favourite music player."))
        about.set_license(
            "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA."
        )
        about.set_wrap_license(True)
        about.set_documenters(["Randal Barlow <im.tehk at gmail.com>"])
        about.set_artists(["Claudio Benech"])
        about.run()
        about.destroy()


if __name__ == "__main__":
    awn.init(sys.argv[1:])
    vfs.init()
    applet = MediaControlApplet(awn.uid, awn.panel_id)
    awn.embed_applet(applet)
    applet.show_all()
    gtk.main()