~daveeddydotcom/viridianplayer/trunk

« back to all changes in this revision

Viewing changes to viridian

  • Committer: Stefano Karapetsas
  • Date: 2010-12-07 23:20:52 UTC
  • mfrom: (58.1.1 viridianplayer)
  • Revision ID: stefano@karapetsas.com-20101207232052-9ga1qwh3shq9xh5x
MergedĀ upstreamĀ source

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import os
33
33
 
34
34
VIRIDIAN_DIR = os.path.expanduser("~") + os.sep + '.viridian'
35
 
LOCALES_DIR = os.path.abspath(os.path.dirname(__file__)) + os.sep + 'locales' + os.sep
 
35
LOCALES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)) , 'locales')
36
36
 
37
37
class AmpacheService(dbus.service.Object):
 
38
        """Used for single instance"""
38
39
        def __init__(self, app):
39
40
                self.app = app
40
41
                bus_name = dbus.service.BusName('com.daveeddy.Viridian', bus = dbus.SessionBus())
42
43
 
43
44
        @dbus.service.method(dbus_interface='com.daveeddy.Viridian')
44
45
        def show_window(self):
 
46
                """Used to bring the current window to the front"""
45
47
                self.app.window.present()
46
48
 
47
49
if __name__ == "__main__":
54
56
                        method = dbus.SessionBus().get_object("com.daveeddy.Viridian", "/com/daveeddy/Viridian").get_dbus_method("show_window")
55
57
                        method()
56
58
                else:
57
 
                        raise Exception('Not Running')
 
59
                        raise Exception(_('Not Running'))
58
60
        except: # some distros don't support this, so just open a second instance i guess....
59
61
                is_first_time = False
60
62
                if not os.path.exists(VIRIDIAN_DIR):
62
64
                        os.mkdir(VIRIDIAN_DIR)
63
65
                        os.chmod(VIRIDIAN_DIR, 0700)
64
66
                                
65
 
                db_session   = AmpacheTools.DatabaseSession(VIRIDIAN_DIR + os.sep + 'viridian.sqlite')
 
67
                db_session   = AmpacheTools.DatabaseSession(os.path.join(VIRIDIAN_DIR, 'viridian.sqlite'))
66
68
                ampache_conn = AmpacheTools.AmpacheSession()
67
69
                audio_engine = AmpacheTools.AudioEngine(ampache_conn)
68
70
                
69
 
                # create the gui and attach it to the session
70
 
                gui = AmpacheTools.AmpacheGUI(ampache_conn, audio_engine, db_session, is_first_time)
 
71
                # create the gui and give it access to all of the components it needs
 
72
                gui = AmpacheTools.AmpacheGUI(ampache_conn, audio_engine, db_session, is_first_time, __version__)
71
73
                
72
74
                # this is for dbus and single instance
73
75
                service = AmpacheService(gui)