commit
398d1243bb
|
@ -56,23 +56,19 @@ class PlayerGUI():
|
||||||
image_next = './ButtonGraphics/Next.png'
|
image_next = './ButtonGraphics/Next.png'
|
||||||
image_exit = './ButtonGraphics/Exit.png'
|
image_exit = './ButtonGraphics/Exit.png'
|
||||||
|
|
||||||
self.TextElem = g.T('Song loading....', size=(85, 5 + NumFiles), font=("Helvetica", 14), auto_size_text=False)
|
self.TextElem = g.T('Song loading....', size=(85,5 + NumFiles), font=("Helvetica", 14), auto_size_text=False)
|
||||||
form = g.FlexForm('MIDI File Player', default_element_size=(30, 1),font=("Helvetica", 25))
|
form = g.FlexForm('MIDI File Player', default_element_size=(30,1),font=("Helvetica", 25))
|
||||||
layout = [
|
layout = [
|
||||||
[g.T('MIDI File Player', size=(30, 1), font=("Helvetica", 25))],
|
[g.T('MIDI File Player', size=(30,1), font=("Helvetica", 25))],
|
||||||
[self.TextElem],
|
[self.TextElem],
|
||||||
[g.ReadFormButton('PAUSE', button_color=g.TRANSPARENT_BUTTON,
|
[g.ReadFormButton('PAUSE', button_color=g.TRANSPARENT_BUTTON,
|
||||||
image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0,
|
image_filename=image_pause, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '),
|
||||||
font=("Helvetica", 15), size=(10, 2)), g.T(' ' * 3),
|
|
||||||
g.ReadFormButton('NEXT', button_color=g.TRANSPARENT_BUTTON,
|
g.ReadFormButton('NEXT', button_color=g.TRANSPARENT_BUTTON,
|
||||||
image_filename=image_next, image_size=(50,50),image_subsample=2, border_width=0,
|
image_filename=image_next, image_size=(50,50),image_subsample=2, border_width=0), g.T(' '),
|
||||||
size=(10, 2), font=("Helvetica", 15)), g.T(' ' * 3),
|
|
||||||
g.ReadFormButton('Restart Song', button_color=g.TRANSPARENT_BUTTON,
|
g.ReadFormButton('Restart Song', button_color=g.TRANSPARENT_BUTTON,
|
||||||
image_filename=image_restart, image_size=(50,50), image_subsample=2,border_width=0,
|
image_filename=image_restart, image_size=(50,50), image_subsample=2, border_width=0), g.T(' '),
|
||||||
size=(10, 2), font=("Helvetica", 15)), g.T(' ' * 3),
|
g.SimpleButton('EXIT', button_color=g.TRANSPARENT_BUTTON,
|
||||||
g.T(' '*2), g.SimpleButton('EXIT', button_color=g.TRANSPARENT_BUTTON,
|
image_filename=image_exit, image_size=(50,50), image_subsample=2, border_width=0,)]
|
||||||
image_filename=image_exit, image_size=(50,50), image_subsample=2,border_width=0,
|
|
||||||
size=(10, 2), font=("Helvetica", 15))]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
form.LayoutAndRead(layout, non_blocking=True)
|
form.LayoutAndRead(layout, non_blocking=True)
|
||||||
|
@ -117,15 +113,13 @@ def main():
|
||||||
'''
|
'''
|
||||||
return int(round(time.time() * 1000))
|
return int(round(time.time() * 1000))
|
||||||
|
|
||||||
g.SetOptions(border_width=1, element_padding=(4, 6), font=("Helvetica", 10), button_color=('white', g.BLUES[0]),
|
|
||||||
progress_meter_border_depth=1, slider_border_width=1)
|
|
||||||
pback = PlayerGUI()
|
pback = PlayerGUI()
|
||||||
|
|
||||||
button, values = pback.PlayerChooseSongGUI()
|
button, values = pback.PlayerChooseSongGUI()
|
||||||
if button != 'PLAY!':
|
if button != 'PLAY!':
|
||||||
g.MsgBoxCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2)
|
g.MsgBoxCancel('Cancelled...\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2)
|
||||||
exit(69)
|
exit(69)
|
||||||
if values['device'] is not None:
|
if values['device']:
|
||||||
midi_port = values['device'][0]
|
midi_port = values['device'][0]
|
||||||
else:
|
else:
|
||||||
g.MsgBoxCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2)
|
g.MsgBoxCancel('No devices found\nAutoclose in 2 sec...', auto_close=True, auto_close_duration=2)
|
||||||
|
|
|
@ -512,24 +512,21 @@ class TKProgressBar():
|
||||||
if orientation[0].lower() == 'h':
|
if orientation[0].lower() == 'h':
|
||||||
s = ttk.Style()
|
s = ttk.Style()
|
||||||
s.theme_use(style)
|
s.theme_use(style)
|
||||||
s.configure("my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width)
|
s.configure(str(length)+str(width)+"my.Horizontal.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width)
|
||||||
self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style='my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate')
|
self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Horizontal.TProgressbar', length=length, orient=tk.HORIZONTAL, mode='determinate')
|
||||||
# self.TKCanvas = tk.Canvas(root, width=length, height=width, highlightt=highlightt, relief=relief, borderwidth=border_width)
|
|
||||||
# self.TKRect = self.TKCanvas.create_rectangle(0, 0, -(length * 1.5), width * 1.5, fill=BarColor[0], tags='bar')
|
|
||||||
# self.canvas.pack(padx='10')
|
|
||||||
else:
|
else:
|
||||||
# s = ttk.Style()
|
|
||||||
# s.theme_use('clam')
|
|
||||||
# s.configure('Vertical.mycolor.progbar', forground=BarColor[0], background=BarColor[1])
|
|
||||||
s = ttk.Style()
|
s = ttk.Style()
|
||||||
s.theme_use(style)
|
s.theme_use(style)
|
||||||
s.configure("my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width)
|
s.configure(str(length)+str(width)+"my.Vertical.TProgressbar", background=BarColor[0], troughcolor=BarColor[1], troughrelief=relief, borderwidth=border_width, thickness=width)
|
||||||
self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style='my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate')
|
self.TKProgressBarForReal = ttk.Progressbar(root, maximum=self.Max, style=str(length)+str(width)+'my.Vertical.TProgressbar', length=length, orient=tk.VERTICAL, mode='determinate')
|
||||||
# self.TKCanvas = tk.Canvas(root, width=width, height=length, highlightt=highlightt, relief=relief, borderwidth=border_width)
|
|
||||||
# self.TKRect = self.TKCanvas.create_rectangle(width * 1.5, 2 * length + 40, 0, length * .5, fill=BarColor[0], tags='bar')
|
|
||||||
# self.canvas.pack()
|
|
||||||
|
|
||||||
def Update(self, count):
|
def Update(self, count, max=None):
|
||||||
|
if max is not None:
|
||||||
|
self.Max = max
|
||||||
|
try:
|
||||||
|
self.TKProgressBarForReal.config(maximum=max)
|
||||||
|
except:
|
||||||
|
return False
|
||||||
if count > self.Max: return False
|
if count > self.Max: return False
|
||||||
try:
|
try:
|
||||||
self.TKProgressBarForReal['value'] = count
|
self.TKProgressBarForReal['value'] = count
|
||||||
|
@ -757,17 +754,17 @@ class ProgressBar(Element):
|
||||||
self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH
|
self.BorderWidth = border_width if border_width else DEFAULT_PROGRESS_BAR_BORDER_WIDTH
|
||||||
self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF
|
self.Relief = relief if relief else DEFAULT_PROGRESS_BAR_RELIEF
|
||||||
self.BarExpired = False
|
self.BarExpired = False
|
||||||
super().__init__(ELEM_TYPE_PROGRESS_BAR, scale, size, auto_size_text)
|
super().__init__(ELEM_TYPE_PROGRESS_BAR, scale=scale, size=size, auto_size_text=auto_size_text)
|
||||||
return
|
return
|
||||||
|
|
||||||
def UpdateBar(self, current_count):
|
def UpdateBar(self, current_count, max=None):
|
||||||
if self.ParentForm.TKrootDestroyed:
|
if self.ParentForm.TKrootDestroyed:
|
||||||
return False
|
return False
|
||||||
self.TKProgressBar.Update(current_count)
|
self.TKProgressBar.Update(current_count, max=max)
|
||||||
try:
|
try:
|
||||||
self.ParentForm.TKroot.update()
|
self.ParentForm.TKroot.update()
|
||||||
except:
|
except:
|
||||||
# _my_windows.Decrement()
|
_my_windows.Decrement()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -840,8 +837,11 @@ class Slider(Element):
|
||||||
super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key)
|
super().__init__(ELEM_TYPE_INPUT_SLIDER, scale=scale, size=size, font=font, background_color=background_color, text_color=text_color, key=key)
|
||||||
return
|
return
|
||||||
|
|
||||||
def Update(self, value):
|
def Update(self, value, range=(None, None)):
|
||||||
self.TKIntVar.set(value)
|
self.TKIntVar.set(value)
|
||||||
|
if range != (None, None):
|
||||||
|
self.TKScale.config(from_ = range[0], to_ = range[1])
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
super().__del__()
|
super().__del__()
|
||||||
|
@ -1749,6 +1749,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT:
|
if text_color is not None and text_color != COLOR_SYSTEM_DEFAULT:
|
||||||
tkscale.configure(fg=text_color)
|
tkscale.configure(fg=text_color)
|
||||||
tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1])
|
tkscale.pack(side=tk.LEFT, padx=element.Pad[0],pady=element.Pad[1])
|
||||||
|
element.TKScale = tkscale
|
||||||
#............................DONE WITH ROW pack the row of widgets ..........................#
|
#............................DONE WITH ROW pack the row of widgets ..........................#
|
||||||
# done with row, pack the row of widgets
|
# done with row, pack the row of widgets
|
||||||
tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0])
|
tk_row_frame.grid(row=row_num+2, sticky=tk.NW, padx=DEFAULT_MARGINS[0])
|
||||||
|
|
Loading…
Reference in New Issue