diff --git a/src/main.py b/src/main.py index daeddda..67585f9 100644 --- a/src/main.py +++ b/src/main.py @@ -1,17 +1,21 @@ #!/usr/bin/env python3 import threading import time -from typing import NewType import pychromecast import wx import wx.lib.scrolledpanel as scrolled import wx.media -from Channel import SVT, Channel, YouTube +from Channel import SVT, YouTube from ChannelProvider import ChannelProvider from Utils import make_sized_button +WIDTH = 720 +HEIGHT = 1440 +BTN_HEIGHT = 40 +SPACER_HEIGHT = 10 + class Cast(wx.Frame): def __init__(self, *args, **kw): """__init__. @@ -20,7 +24,7 @@ class Cast(wx.Frame): """ super().__init__(*args, **kw) self.m_selected_chromecast = None - self.SetSizeHints(480, 480, maxW=480) + self.SetSizeHints(WIDTH, HEIGHT, maxW=WIDTH) self.m_index = 0 self.m_chromecast_thr = threading.Thread( target=self.get_chromecasts, args=(), kwargs={} @@ -85,10 +89,10 @@ class Cast(wx.Frame): self.m_selected_provider = self.m_providers[provider_index] self.m_sizer.Clear(delete_windows=True) self.m_sizer = wx.BoxSizer(wx.VERTICAL) - backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(480, 40)) + backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(WIDTH, BTN_HEIGHT)) backbtn.Bind(wx.EVT_BUTTON, lambda event: self.show_provider_list(event)) self.m_sizer.Add(backbtn, wx.ALIGN_CENTER_VERTICAL) - self.m_sizer.AddSpacer(10) + self.m_sizer.AddSpacer(SPACER_HEIGHT) channel_index = 0 for channel in self.m_selected_provider.get_channels(): bitmap = channel.get_logo_as_bitmap() @@ -97,6 +101,7 @@ class Cast(wx.Frame): self.m_sizer.Add(btn_sizer) channel_index += 1 + self.m_sizer.AddSpacer(SPACER_HEIGHT) self.m_panel.SetSizer(self.m_sizer) self.m_sizer.Fit(self) self.m_panel.Layout() @@ -119,13 +124,13 @@ class Cast(wx.Frame): time.sleep(1) wx.GetApp().Yield() - backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(480, 40)) + backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(WIDTH, BTN_HEIGHT)) backbtn.Bind( wx.EVT_BUTTON, lambda event: self.show_channel_list(event, self.m_selected_provider_index), ) self.m_sizer.Add(backbtn, wx.ALIGN_CENTER_VERTICAL) - self.m_sizer.AddSpacer(10) + self.m_sizer.AddSpacer(SPACER_HEIGHT) for item in channel.get_items(): title = wx.StaticText(self.m_panel, -1) title.SetLabelMarkup("{}".format(item["title"])) @@ -143,8 +148,9 @@ class Cast(wx.Frame): self.m_sizer.Add(title) self.m_sizer.Add(btn) self.m_sizer.Add(description) - self.m_sizer.AddSpacer(10) + self.m_sizer.AddSpacer(SPACER_HEIGHT) self.m_index = self.m_index + 1 + self.m_sizer.AddSpacer(SPACER_HEIGHT) self.m_panel.SetSizer(self.m_sizer) self.m_sizer.Fit(self) self.m_panel.Layout() @@ -160,7 +166,7 @@ class Cast(wx.Frame): self.m_sizer = wx.GridBagSizer() self.m_control = wx.media.MediaCtrl( self.m_panel, - size=(480, 480), + size=(WIDTH, HEIGHT), style=wx.SIMPLE_BORDER, szBackend=wx.media.MEDIABACKEND_GSTREAMER, ) @@ -203,6 +209,7 @@ class Cast(wx.Frame): pause_button.Bind(wx.EVT_BUTTON, self.pause) self.Bind(wx.media.EVT_MEDIA_FINISHED, self.show_video_list) + self.m_sizer.AddSpacer(SPACER_HEIGHT) self.load_uri(uri) self.m_panel.SetSizer(self.m_sizer) self.m_sizer.Fit(self) @@ -215,7 +222,7 @@ class Cast(wx.Frame): for cast in self.m_chromecasts: friendly_name = cast.cast_info.friendly_name - btn = wx.Button(self.m_panel, id=-1, label=friendly_name, size=(480, 40)) + btn = wx.Button(self.m_panel, id=-1, label=friendly_name, size=(WIDTH, BTN_HEIGHT)) btn.Bind( wx.EVT_BUTTON, lambda event, chromecast=cast, muri=uri, index=provider_index: self.set_chromecast( @@ -223,6 +230,7 @@ class Cast(wx.Frame): ), ) self.m_sizer.Add(btn, wx.ALIGN_CENTER_VERTICAL) + self.m_sizer.AddSpacer(SPACER_HEIGHT) self.m_panel.SetSizer(self.m_sizer) self.m_sizer.Fit(self) self.m_panel.Layout()