Exemplo n.º 1
0
    def __init__(self):
        GLib.set_prgname('kickoff-player')
        GLib.set_application_name('Kickoff Player')

        add_custom_css('ui/styles.css')

        self.cache = CacheHandler()
        self.data = DataHandler()

        self.scores_api = ScoresApi(self.data, self.cache)
        self.streams_api = StreamsApi(self.data, self.cache)

        self.main = Gtk.Builder()
        self.main.add_from_file('ui/main.ui')
        self.main.connect_signals(self)

        self.window = self.main.get_object('window_main')
        self.header_back = self.main.get_object('header_button_back')
        self.header_reload = self.main.get_object('header_button_reload')
        self.main_stack = self.main.get_object('stack_main')

        self.player_stack = self.main.get_object('stack_player')
        self.matches_stack = self.main.get_object('stack_matches')
        self.matches_loader = self.main.get_object('spinner_matches')
        self.channels_loader = self.main.get_object('spinner_channels')
        self.channels_stack = self.main.get_object('stack_channels')

        self.matches = MatchHandler(self)
        self.channels = ChannelHandler(self)
        self.player = PlayerHandler(self)
Exemplo n.º 2
0
  def __init__(self):
    GLib.set_prgname('kickoff-player')
    GLib.set_application_name('Kickoff Player')

    add_custom_css('ui/styles.css')

    self.argparse = argparse.ArgumentParser(prog='kickoff-player')
    self.argparse.add_argument('url', metavar='URL', nargs='?', default=None)

    self.cache = CacheHandler()
    self.data  = DataHandler()

    self.scores_api  = ScoresApi(self.data, self.cache)
    self.streams_api = StreamsApi(self.data, self.cache)

    self.main = Gtk.Builder()
    self.main.add_from_file(relative_path('ui/main.ui'))
    self.main.connect_signals(self)

    self.window        = self.main.get_object('window_main')
    self.header_back   = self.main.get_object('header_button_back')
    self.header_reload = self.main.get_object('header_button_reload')
    self.main_stack    = self.main.get_object('stack_main')

    self.player_stack   = self.main.get_object('stack_player')
    self.matches_stack  = self.main.get_object('stack_matches')
    self.channels_stack = self.main.get_object('stack_channels')

    self.matches  = MatchHandler(self)
    self.channels = ChannelHandler(self)
    self.player   = PlayerHandler(self)

    GLib.timeout_add(2000, self.toggle_reload, True)
    self.open_stream_url()
Exemplo n.º 3
0
    def __init__(self):
        self.data = DataHandler()
        self.cache = CacheHandler()

        self.scores_api = OnefootballApi(self.data, self.cache)
        self.streams_api = LivefootballApi(self.data, self.cache)

        self.add_extra_styles('ui/styles.css')

        self.main = Gtk.Builder()
        self.main.add_from_file('ui/main.ui')
        self.main.connect_signals(self)

        self.header_back = self.main.get_object('header_button_back')
        self.header_reload = self.main.get_object('header_button_reload')
        self.main_stack = self.main.get_object('stack_main')

        self.window = self.main.get_object('window_main')
        self.window.show_all()

        self.player_stack = self.main.get_object('stack_player')
        self.player = PlayerHandler(self)

        self.matches_loader = self.main.get_object('spinner_matches')
        self.matches_stack = self.main.get_object('stack_matches')
        self.matches = MatchHandler(self)

        self.channels_loader = self.main.get_object('spinner_channels')
        self.channels_stack = self.main.get_object('stack_channels')
        self.channels = ChannelHandler(self)

        self.set_stack_visible_child(self.channels_stack)
        self.set_stack_visible_child(self.matches_stack)
Exemplo n.º 4
0
class KickoffPlayer(object):
    def __init__(self, cache, data):
        GLib.set_prgname('kickoff-player')
        GLib.set_application_name('Kickoff Player')

        add_custom_css('ui/styles.css')

        self.argparse = argparse.ArgumentParser(prog='kickoff-player')
        self.argparse.add_argument('url',
                                   metavar='URL',
                                   nargs='?',
                                   default=None)

        self.cache = cache
        self.data = data

        self.scores_api = ScoresApi(self.data, self.cache)
        self.streams_api = StreamsApi(self.data, self.cache)

        self.main = Gtk.Builder()
        self.main.add_from_file(relative_path('ui/main.ui'))
        self.main.connect_signals(self)

        self.window = self.main.get_object('window_main')
        self.header_back = self.main.get_object('header_button_back')
        self.header_reload = self.main.get_object('header_button_reload')
        self.main_stack = self.main.get_object('stack_main')

        self.player_stack = self.main.get_object('stack_player')
        self.matches_stack = self.main.get_object('stack_matches')
        self.channels_stack = self.main.get_object('stack_channels')

        self.matches = MatchHandler(self)
        self.channels = ChannelHandler(self)
        self.player = PlayerHandler(self)

        GLib.timeout_add(2000, self.toggle_reload, True)
        self.open_stream_url()

    def run(self):
        self.window.show_all()
        Gtk.main()

    def quit(self):
        self.player.close()
        Gtk.main_quit()

    def open_stream_url(self):
        url = self.argparse.parse_args().url

        if url is not None:
            stream = StaticStream(url)
            self.player.open_stream(stream)

            self.set_stack_visible_child(self.player_stack)

    def toggle_reload(self, show):
        self.header_reload.set_sensitive(show)

    def get_stack_visible_child(self):
        return self.main_stack.get_visible_child()

    def set_stack_visible_child(self, widget):
        self.main_stack.set_visible_child(widget)

    def on_window_main_destroy(self, _event):
        self.quit()

    def on_window_main_key_release_event(self, widget, event):
        self.player.on_window_main_key_release_event(widget, event)

    def on_header_button_back_clicked(self, widget):
        self.matches.on_header_button_back_clicked(widget)

    def on_header_button_reload_clicked(self, widget):
        self.player.on_header_button_reload_clicked(widget)
        self.matches.on_header_button_reload_clicked(widget)
        self.channels.on_header_button_reload_clicked(widget)

    def on_stack_main_visible_child_notify(self, widget, params):
        self.matches.on_stack_main_visible_child_notify(widget, params)
        self.channels.on_stack_main_visible_child_notify(widget, params)
Exemplo n.º 5
0
class KickoffPlayer(object):
    def __init__(self):
        GLib.set_prgname('kickoff-player')
        GLib.set_application_name('Kickoff Player')

        add_custom_css('ui/styles.css')

        self.cache = CacheHandler()
        self.data = DataHandler()

        self.scores_api = ScoresApi(self.data, self.cache)
        self.streams_api = StreamsApi(self.data, self.cache)

        self.main = Gtk.Builder()
        self.main.add_from_file('ui/main.ui')
        self.main.connect_signals(self)

        self.window = self.main.get_object('window_main')
        self.header_back = self.main.get_object('header_button_back')
        self.header_reload = self.main.get_object('header_button_reload')
        self.main_stack = self.main.get_object('stack_main')

        self.player_stack = self.main.get_object('stack_player')
        self.matches_stack = self.main.get_object('stack_matches')
        self.matches_loader = self.main.get_object('spinner_matches')
        self.channels_loader = self.main.get_object('spinner_channels')
        self.channels_stack = self.main.get_object('stack_channels')

        self.matches = MatchHandler(self)
        self.channels = ChannelHandler(self)
        self.player = PlayerHandler(self)

    def run(self):
        self.window.show_all()
        Gtk.main()

    def quit(self):
        self.player.close()
        Gtk.main_quit()

    def toggle_reload(self, show):
        self.header_reload.set_sensitive(show)

    def get_stack_visible_child(self):
        return self.main_stack.get_visible_child()

    def set_stack_visible_child(self, widget):
        self.main_stack.set_visible_child(widget)

    def on_window_main_destroy(self, _event):
        self.quit()

    def on_window_main_key_release_event(self, widget, event):
        self.player.on_window_main_key_release_event(widget, event)

    def on_header_button_back_clicked(self, widget):
        self.matches.on_header_button_back_clicked(widget)

    def on_header_button_reload_clicked(self, widget):
        self.player.on_header_button_reload_clicked(widget)
        self.matches.on_header_button_reload_clicked(widget)
        self.channels.on_header_button_reload_clicked(widget)

    def on_stack_main_visible_child_notify(self, widget, params):
        self.matches.on_stack_main_visible_child_notify(widget, params)
        self.channels.on_stack_main_visible_child_notify(widget, params)
Exemplo n.º 6
0
class KickoffPlayer:
    def __init__(self):
        self.data = DataHandler()
        self.cache = CacheHandler()

        self.scores_api = OnefootballApi(self.data, self.cache)
        self.streams_api = LivefootballApi(self.data, self.cache)

        self.add_extra_styles('ui/styles.css')

        self.main = Gtk.Builder()
        self.main.add_from_file('ui/main.ui')
        self.main.connect_signals(self)

        self.header_back = self.main.get_object('header_button_back')
        self.header_reload = self.main.get_object('header_button_reload')
        self.main_stack = self.main.get_object('stack_main')

        self.window = self.main.get_object('window_main')
        self.window.show_all()

        self.player_stack = self.main.get_object('stack_player')
        self.player = PlayerHandler(self)

        self.matches_loader = self.main.get_object('spinner_matches')
        self.matches_stack = self.main.get_object('stack_matches')
        self.matches = MatchHandler(self)

        self.channels_loader = self.main.get_object('spinner_channels')
        self.channels_stack = self.main.get_object('stack_channels')
        self.channels = ChannelHandler(self)

        self.set_stack_visible_child(self.channels_stack)
        self.set_stack_visible_child(self.matches_stack)

    def run(self):
        Gtk.main()

    def quit(self):
        self.player.close()
        Gtk.main_quit()

    def add_extra_styles(self, path):
        path_style_provider = Gtk.CssProvider()
        path_style_provider.load_from_path(path)

        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(), path_style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

    def toggle_reload(self, show):
        self.header_reload.set_sensitive(show)

    def get_stack_visible_child(self):
        child = self.main_stack.get_visible_child()

        return child

    def set_stack_visible_child(self, widget):
        self.main_stack.set_visible_child(widget)

    def on_window_main_destroy(self, _event):
        self.quit()

    def on_window_main_key_release_event(self, widget, event):
        self.player.on_window_main_key_release_event(widget, event)

    def on_header_button_back_clicked(self, widget):
        self.matches.on_header_button_back_clicked(widget)

    def on_header_button_reload_clicked(self, widget):
        self.player.on_header_button_reload_clicked(widget)
        self.matches.on_header_button_reload_clicked(widget)
        self.channels.on_header_button_reload_clicked(widget)

    def on_stack_main_visible_child_notify(self, widget, params):
        self.matches.on_stack_main_visible_child_notify(widget, params)
        self.channels.on_stack_main_visible_child_notify(widget, params)