class Client(object): '''This is a client application of Entertainer. Entertainer's client hooks into the server, and then provides a user interface for the data the server creates.''' def __init__(self): config = Configuration() music_library = MusicLibrary() image_library = ImageLibrary() video_library = VideoLibrary() self.ui = UserInterface(image_library, music_library, video_library, self.quit_client) if config.tray_icon_enabled: SystemTrayIcon(self.quit_client, self.toggle_interface_visibility) startLogging(sys.stdout) client = EntertainerLocalClientProtocol ClientCreator(reactor, client) # ClientCreator(reactor, client).connectTCP( # config.network_options['host'], # config.network_options['port']) def start(self): '''Start the necessary main loop.''' self.ui.start_up() self.interface_visible = True gtk.gdk.threads_enter() reactor.run() gtk.gdk.threads_leave() def quit_client(self): '''Close the client.''' reactor.stop() sys.exit(0) def toggle_interface_visibility(self): '''Toggle between showing and hiding the interface's visibility.''' if self.interface_visible: self.ui.hide() self.interface_visible = False else: self.ui.show() self.interface_visible = True
class Client(object): '''This is a client application of Entertainer. Entertainer's client hooks into the server, and then provides a user interface for the data the server creates.''' def __init__(self): config = Configuration() music_library = MusicLibrary() image_library = ImageLibrary() video_library = VideoLibrary() self.ui = UserInterface(image_library, music_library, video_library, self.quit_client) if config.tray_icon_enabled: SystemTrayIcon(self.quit_client, self.toggle_interface_visibility) startLogging(sys.stdout) client = EntertainerLocalClientProtocol ClientCreator(reactor, client) # ClientCreator(reactor, client).connectTCP( # config.network_options['host'], # config.network_options['port']) def start(self): '''Start the necessary main loop.''' self.ui.start_up() self.interface_visible = True gtk.gdk.threads_enter() reactor.run() gtk.gdk.threads_leave() def quit_client(self): '''Close the client.''' reactor.stop() sys.exit(0) def toggle_interface_visibility(self): '''Toggle between showing and hiding the interface's visibility.''' if self.interface_visible: self.ui.hide() self.interface_visible = False else: self.ui.show() self.interface_visible = True