Added changes to make GUI compatible for Python 2 and 3
This commit is contained in:
parent
15ab0bb38d
commit
500671d2a7
@ -25,8 +25,8 @@ class mainWindow(wx.Frame):
|
|||||||
help_ = wx.Menu()
|
help_ = wx.Menu()
|
||||||
self.about = help_.Append(wx.NewId(), _(u"About {0}").format(application.name,))
|
self.about = help_.Append(wx.NewId(), _(u"About {0}").format(application.name,))
|
||||||
self.check_for_updates = help_.Append(wx.NewId(), _(u"Check for updates"))
|
self.check_for_updates = help_.Append(wx.NewId(), _(u"Check for updates"))
|
||||||
self.changelog = help_.Append(wx.NewId(), _("What's new in this version?"))
|
self.changelog = help_.Append(wx.NewId(), _(u"What's new in this version?"))
|
||||||
self.website = help_.Append(wx.NewId(), _("Visit website"))
|
self.website = help_.Append(wx.NewId(), _(u"Visit website"))
|
||||||
mb.Append(player, _(u"Player"))
|
mb.Append(player, _(u"Player"))
|
||||||
mb.Append(help_, _(u"Help"))
|
mb.Append(help_, _(u"Help"))
|
||||||
self.SetMenuBar(mb)
|
self.SetMenuBar(mb)
|
||||||
@ -43,29 +43,29 @@ class mainWindow(wx.Frame):
|
|||||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
box.Add(lbl2, 0, wx.GROW)
|
box.Add(lbl2, 0, wx.GROW)
|
||||||
box.Add(self.text, 1, wx.GROW)
|
box.Add(self.text, 1, wx.GROW)
|
||||||
box.Add(wx.StaticText(self.panel, wx.NewId(), _("Search in")), 0, wx.GROW)
|
box.Add(wx.StaticText(self.panel, wx.NewId(), _(u"Search in")), 0, wx.GROW)
|
||||||
self.extractor = wx.ComboBox(self.panel, wx.NewId(), choices=["youtube", "vk", "mail.ru", "zaycev.net"], value="youtube", style=wx.CB_READONLY)
|
self.extractor = wx.ComboBox(self.panel, wx.NewId(), choices=["youtube", "vk", "mail.ru", "zaycev.net"], value="youtube", style=wx.CB_READONLY)
|
||||||
box.Add(self.extractor, 1, wx.GROW)
|
box.Add(self.extractor, 1, wx.GROW)
|
||||||
self.search = wx.Button(self.panel, wx.NewId(), _("Search"))
|
self.search = wx.Button(self.panel, wx.NewId(), _(u"Search"))
|
||||||
self.search.SetDefault()
|
self.search.SetDefault()
|
||||||
box.Add(self.search, 0, wx.GROW)
|
box.Add(self.search, 0, wx.GROW)
|
||||||
self.sizer.Add(box, 0, wx.GROW)
|
self.sizer.Add(box, 0, wx.GROW)
|
||||||
lbl = wx.StaticText(self.panel, wx.NewId(), _("Results"))
|
lbl = wx.StaticText(self.panel, wx.NewId(), _(u"Results"))
|
||||||
self.list = wx.ListBox(self.panel, wx.NewId())
|
self.list = wx.ListBox(self.panel, wx.NewId())
|
||||||
self.sizer.Add(lbl, 0, wx.GROW)
|
self.sizer.Add(lbl, 0, wx.GROW)
|
||||||
self.sizer.Add(self.list, 1, wx.GROW)
|
self.sizer.Add(self.list, 1, wx.GROW)
|
||||||
box1 = wx.BoxSizer(wx.HORIZONTAL)
|
box1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
box2 = wx.BoxSizer(wx.HORIZONTAL)
|
box2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
box1.Add(wx.StaticText(self.panel, wx.NewId(), _("Position")), 0, wx.GROW)
|
box1.Add(wx.StaticText(self.panel, wx.NewId(), _(u"Position")), 0, wx.GROW)
|
||||||
self.time_slider = wx.Slider(self.panel, -1)
|
self.time_slider = wx.Slider(self.panel, -1)
|
||||||
box1.Add(self.time_slider, 1, wx.GROW)
|
box1.Add(self.time_slider, 1, wx.GROW)
|
||||||
box1.Add(wx.StaticText(self.panel, wx.NewId(), _("Volume")), 0, wx.GROW)
|
box1.Add(wx.StaticText(self.panel, wx.NewId(), _(u"Volume")), 0, wx.GROW)
|
||||||
self.vol_slider = wx.Slider(self.panel, -1, 0, 0, 100, size=(100, -1))
|
self.vol_slider = wx.Slider(self.panel, -1, 0, 0, 100, size=(100, -1))
|
||||||
box1.Add(self.vol_slider, 1, wx.GROW)
|
box1.Add(self.vol_slider, 1, wx.GROW)
|
||||||
self.previous = wx.Button(self.panel, wx.NewId(), _("Previous"))
|
self.previous = wx.Button(self.panel, wx.NewId(), _(u"Previous"))
|
||||||
self.play = wx.Button(self.panel, wx.NewId(), _("Play"))
|
self.play = wx.Button(self.panel, wx.NewId(), _(u"Play"))
|
||||||
self.stop = wx.Button(self.panel, wx.NewId(), _("Stop"))
|
self.stop = wx.Button(self.panel, wx.NewId(), _(u"Stop"))
|
||||||
self.next = wx.Button(self.panel, wx.NewId(), _("Next"))
|
self.next = wx.Button(self.panel, wx.NewId(), _(u"Next"))
|
||||||
box2.Add(self.previous)
|
box2.Add(self.previous)
|
||||||
box2.Add(self.play, flag=wx.RIGHT, border=5)
|
box2.Add(self.play, flag=wx.RIGHT, border=5)
|
||||||
box2.Add(self.stop)
|
box2.Add(self.stop)
|
||||||
@ -116,5 +116,5 @@ class mainWindow(wx.Frame):
|
|||||||
try:
|
try:
|
||||||
self.notification = wx.adv.NotificationMessage(title, text, parent=self)
|
self.notification = wx.adv.NotificationMessage(title, text, parent=self)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.notification = wx.NotificationMessage(title, text, parent=self)
|
self.notification = wx.NotificationMessage(title, text)
|
||||||
self.notification.Show()
|
self.notification.Show()
|
@ -1,10 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import wx
|
import wx
|
||||||
|
import application
|
||||||
|
|
||||||
class contextMenu(wx.Menu):
|
class contextMenu(wx.Menu):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(contextMenu, self).__init__(*args, **kwargs)
|
super(contextMenu, self).__init__(*args, **kwargs)
|
||||||
self.play = wx.MenuItem(self, wx.NewId(), _("Play/Pause"))
|
self.play = wx.MenuItem(self, wx.NewId(), _(u"Play/Pause"))
|
||||||
|
self.download = wx.MenuItem(self, wx.NewId(), _(u"Download"))
|
||||||
|
if application.python_version == 3:
|
||||||
self.Append(self.play)
|
self.Append(self.play)
|
||||||
self.download = wx.MenuItem(self, wx.NewId(), _("Download"))
|
|
||||||
self.Append(self.download)
|
self.Append(self.download)
|
||||||
|
else:
|
||||||
|
self.AppendItem(self.play)
|
||||||
|
self.AppendItem(self.download)
|
||||||
|
Loading…
Reference in New Issue
Block a user