Add back size so it works on x11 too
This commit is contained in:
parent
67589b5def
commit
c2502162a8
1 changed files with 20 additions and 11 deletions
31
src/main.py
31
src/main.py
|
@ -12,8 +12,9 @@ from youtubesearchpython import ChannelsSearch
|
|||
|
||||
from Channel import SVT, YouTube
|
||||
from ChannelProvider import ChannelProvider
|
||||
from Utils import (get_default_logo, get_subscriptions, import_from_newpipe, make_bitmap_from_file, make_sized_button,
|
||||
resolve_youtube_link, make_bitmap_from_url)
|
||||
from Utils import (get_default_logo, get_subscriptions, import_from_newpipe,
|
||||
make_bitmap_from_file, make_bitmap_from_url,
|
||||
make_sized_button, resolve_youtube_link)
|
||||
|
||||
WIDTH = int(720 / 2)
|
||||
HEIGHT = int(1440 / 2)
|
||||
|
@ -63,10 +64,15 @@ class Cast(wx.Frame):
|
|||
def search_callback(event, text: wx.TextCtrl) -> None:
|
||||
reply = text.GetLineText(0)
|
||||
text.Clear()
|
||||
channels_search = ChannelsSearch(reply,
|
||||
limit=1).result()['result'][0] #type: ignore
|
||||
channels_search = ChannelsSearch(
|
||||
reply, limit=1).result()['result'][0] #type: ignore
|
||||
if 'id' in channels_search:
|
||||
found_channel = YouTube.YouTube(channels_search['id'], channels_search['title'], logo=make_bitmap_from_url('https:' + channels_search['thumbnails'][0]['url'], size=wx.Size(68,100))) #type: ignore
|
||||
found_channel = YouTube.YouTube(
|
||||
channels_search['id'],
|
||||
channels_search['title'],
|
||||
logo=make_bitmap_from_url(
|
||||
'https:' + channels_search['thumbnails'][0]['url'],
|
||||
size=wx.Size(68, 100))) #type: ignore
|
||||
self.m_selected_provider.append_channel(found_channel)
|
||||
|
||||
text: wx.TextCtrl = wx.TextCtrl(self.m_panel, size=(WIDTH, BTN_HEIGHT))
|
||||
|
@ -134,14 +140,14 @@ class Cast(wx.Frame):
|
|||
inner_sizer.Add(chromecast_button, FLAGS)
|
||||
elif self.m_selected_chromecast:
|
||||
|
||||
|
||||
chromecast_button = wx.Button(self.m_panel,
|
||||
-1,
|
||||
"Stop Cast",
|
||||
size=(WIDTH / 4, BTN_HEIGHT))
|
||||
chromecast_button.Bind(
|
||||
wx.EVT_BUTTON,
|
||||
lambda event, muri=uri, cindex=channel_index: self.stop_callback(event, muri, cindex),
|
||||
lambda event, muri=uri, cindex=channel_index: self.
|
||||
stop_callback(event, muri, cindex),
|
||||
)
|
||||
inner_sizer.Add(chromecast_button, FLAGS)
|
||||
|
||||
|
@ -182,9 +188,11 @@ class Cast(wx.Frame):
|
|||
logo = make_bitmap_from_file(channel[2])
|
||||
channels.append(YouTube.YouTube(channel[0], channel[1], logo))
|
||||
else:
|
||||
logo = make_bitmap_from_url('https://yt3.ggpht.com/ytc/AKedOLQ5L9xUSDxB2j6V3VC8L_HEwiKeHM21CgbSUyqe=s88-c-k-c0x00ffffff-no-rj')
|
||||
logo = make_bitmap_from_url(
|
||||
'https://yt3.ggpht.com/ytc/AKedOLQ5L9xUSDxB2j6V3VC8L_HEwiKeHM21CgbSUyqe=s88-c-k-c0x00ffffff-no-rj'
|
||||
)
|
||||
channels.append(
|
||||
YouTube.YouTube("UCs6A_0Jm21SIvpdKyg9Gmxw", "Pine 64",logo))
|
||||
YouTube.YouTube("UCs6A_0Jm21SIvpdKyg9Gmxw", "Pine 64", logo))
|
||||
|
||||
youtube = ChannelProvider("YouTube", channels=channels)
|
||||
providers.append(youtube)
|
||||
|
@ -226,7 +234,7 @@ class Cast(wx.Frame):
|
|||
label="Close",
|
||||
size=(WIDTH, BTN_HEIGHT))
|
||||
closebtn.Bind(wx.EVT_BUTTON, lambda event: self.Destroy())
|
||||
self.m_sizer.Add(closebtn, 0, wx.ALL,1)
|
||||
self.m_sizer.Add(closebtn, 0, wx.ALL, 1)
|
||||
provider_index = 0
|
||||
|
||||
for provider in self.m_providers:
|
||||
|
@ -236,7 +244,7 @@ class Cast(wx.Frame):
|
|||
btn_sizer: wx.BoxSizer = make_sized_button(self.m_panel, bitmap,
|
||||
provider.get_name(),
|
||||
callback)
|
||||
self.m_sizer.Add(btn_sizer,0,wx.ALL,1)
|
||||
self.m_sizer.Add(btn_sizer, 0, wx.ALL, 1)
|
||||
provider_index += 1
|
||||
|
||||
self.m_panel.SetupScrolling(rate_y=SCROLL_RATE, scrollToTop=True)
|
||||
|
@ -385,6 +393,7 @@ class Cast(wx.Frame):
|
|||
if not self.m_selected_chromecast:
|
||||
self.m_control = wx.media.MediaCtrl(
|
||||
self.m_panel,
|
||||
size=(WIDTH,HEIGHT/2),
|
||||
szBackend=wx.media.MEDIABACKEND_GSTREAMER,
|
||||
)
|
||||
self.m_sizer.Add(self.m_control, FLAGS)
|
||||
|
|
Loading…
Add table
Reference in a new issue