Border depth support, Refresh of demo programs,
This commit is contained in:
parent
623002b523
commit
05b1043758
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
import PySimpleGUIQt as sg
|
||||
|
||||
sg.ChangeLookAndFeel('Topanga')
|
||||
sg.ChangeLookAndFeel('GreenTan')
|
||||
# sg.SetOptions(text_color='white')
|
||||
# ------ Column Definition ------ #
|
||||
column1 = [[sg.Text('Column 1', background_color='lightblue',text_color='black', justification='center', size=(100,22))],
|
||||
[sg.Spin((1,10), size=(100,22))],
|
||||
|
@ -9,18 +10,18 @@ column1 = [[sg.Text('Column 1', background_color='lightblue',text_color='black',
|
|||
[sg.Spin((1,10), size=(100,22))],]
|
||||
|
||||
layout = [
|
||||
[sg.Text('(Almost) All widgets in one Window!', justification='c', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)],
|
||||
[sg.Text('(Almost) All widgets in one Window!',click_submits=True, key='TEXT', justification='c', font=("Helvetica", 25), relief=sg.RELIEF_RAISED, tooltip='Text Element')],
|
||||
[sg.Text('Here is some text.... and a place to enter text')],
|
||||
[sg.InputText('This is my text', size=(400,22))],
|
||||
[sg.InputText('This is my text', size=(400,25))],
|
||||
[sg.Frame(layout=[
|
||||
[sg.Checkbox('Checkbox', size=(185,22)), sg.Checkbox('My second checkbox!', default=True)],
|
||||
[sg.Radio('My first Radio!', "RADIO1", default=True, size=(180,22), ),sg.Radio('My second Radio!', "RADIO1")],
|
||||
[sg.Radio('Third Radio!', "RADIO2", default=True, size=(180,22), ),
|
||||
sg.Radio('Fourth Radio!', "RADIO2")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN,
|
||||
tooltip='Use these to set flags', ), sg.Stretch()],
|
||||
[sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(220, 80)),
|
||||
[sg.Multiline(default_text='This is the default Text should you decide not to type anything',focus=True, size=(220, 80)),
|
||||
sg.Multiline(default_text='A second multi-line', size=(220, 80))],
|
||||
[sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(150, 22)), sg.Stretch(),
|
||||
[sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(150, 25)), sg.Stretch(),
|
||||
sg.Slider(range=(1, 100), orientation='h', size=(300, 22), default_value=85)],
|
||||
[sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))],
|
||||
[sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(200,100), select_mode=sg.LISTBOX_SELECT_MODE_EXTENDED), sg.Stretch(),
|
||||
|
@ -28,7 +29,7 @@ layout = [
|
|||
sg.Slider(range=(1, 100), orientation='v', default_value=25, tick_interval=25),
|
||||
sg.Slider(range=(1, 100), orientation='v', default_value=75),
|
||||
sg.Slider(range=(1, 100), orientation='v', default_value=10),
|
||||
sg.Column(column1, background_color='lightblue')]], background_color='black'), sg.Stretch()],
|
||||
sg.Column(column1, background_color='lightblue')]], ), sg.Stretch(), sg.Dial((1,100))],
|
||||
[sg.Text('_' * 50, justification='c')],
|
||||
[sg.Text('Choose A Folder')],
|
||||
[sg.Text('Your Folder'),
|
||||
|
@ -43,7 +44,8 @@ window = sg.Window('Everything bagel',
|
|||
keep_on_top=False,
|
||||
element_padding=(2,3),
|
||||
default_element_size=(100, 23),
|
||||
default_button_element_size=(120,30)
|
||||
default_button_element_size=(120,30),
|
||||
# background_image='C:\Python\PycharmProjects\GooeyGUI\logo500black.png',
|
||||
).Layout(layout)
|
||||
event, values = window.Read()
|
||||
print(event, values)
|
||||
|
@ -52,6 +54,6 @@ window.Close()
|
|||
sg.Popup('Title',
|
||||
'The results of the window.',
|
||||
'The button clicked was "{}"'.format(event),
|
||||
'The values are', values)
|
||||
'The values are', values,)
|
||||
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ def main():
|
|||
recording = True
|
||||
elif event == 'Stop':
|
||||
recording = False
|
||||
# img = np.full((480, 640),255)
|
||||
# imgbytes=cv2.imencode('.png', img)[1].tobytes() #this is faster, shorter and needs less includes
|
||||
# window.FindElement('image').Update(data=imgbytes)
|
||||
img = np.full((480, 640),255)
|
||||
imgbytes=cv2.imencode('.png', img)[1].tobytes() #this is faster, shorter and needs less includes
|
||||
window.FindElement('image').Update(data=imgbytes)
|
||||
elif event == 'About':
|
||||
sg.PopupNoWait('Made with PySimpleGUI',
|
||||
'www.PySimpleGUI.org',
|
||||
|
|
|
@ -3,6 +3,7 @@ from random import randint
|
|||
|
||||
def main():
|
||||
sg.ChangeLookAndFeel('GreenTan')
|
||||
# sg.SetOptions(element_padding=(0,0))
|
||||
# ------ Menu Definition ------ #
|
||||
menu_def = [['&File', ['&Open', '&Save', '&Properties', 'E&xit']],
|
||||
['&Edit', ['&Paste', ['Special', 'Normal', ], 'Undo'], ],
|
||||
|
@ -25,37 +26,37 @@ def main():
|
|||
|
||||
|
||||
frame1 = [
|
||||
[sg.Input('Input Text', size=(250,25)), sg.Stretch()],
|
||||
[sg.Input('Input Text', size=(250,35)), sg.Stretch()],
|
||||
[sg.Multiline(size=(250,75),default_text='Multiline Input'),
|
||||
sg.MultilineOutput(size=(250,75),default_text='Multiline Output')],
|
||||
]
|
||||
|
||||
frame2 = [
|
||||
[sg.Listbox(['Listbox 1','Listbox 2','Listbox 3'], size=(200,85))],
|
||||
[sg.Combo(['Combo item 1',], size=(200,35))],
|
||||
[sg.Combo(['Combo item 1','Combo item 2','Combo item 3'], size=(200,35))],
|
||||
[sg.Spin([1,2,3], size=(40,30))],
|
||||
]
|
||||
|
||||
frame3 = [
|
||||
[sg.Checkbox('Checkbox1', True),sg.Checkbox('Checkbox1')],
|
||||
[sg.Radio('Radio Button1', 1), sg.Radio('Radio Button2', 1, default=True)],
|
||||
[sg.Radio('Radio Button1', 1), sg.Radio('Radio Button2', 1, default=True), sg.Stretch()],
|
||||
]
|
||||
|
||||
frame4 = [
|
||||
[sg.Slider(range=(0,100), orientation='v', size=(3, 30), default_value=40), sg.Dial(range=(0,100),size=(200,200), default_value=40), sg.Stretch()],
|
||||
[sg.Slider(range=(0,100), orientation='v', size=(3, 30), default_value=40), sg.Dial(range=(0,100),tick_interval=50, size=(150,150), default_value=40), sg.Stretch()],
|
||||
]
|
||||
matrix = [[str(x*y) for x in range(4)] for y in range(3)]
|
||||
|
||||
frame5 = [
|
||||
[sg.Table(values=matrix, max_col_width=25,
|
||||
auto_size_columns=True, display_row_numbers=True, change_submits=False, bind_return_key=True, justification='right', num_rows=8, alternating_row_color='lightblue', key='_table_', text_color='black'),
|
||||
sg.Tree(data=treedata, headings=['col1', 'col2', 'col3'],change_submits=True, auto_size_columns=True, num_rows=10, col0_width=10, key='_TREE_', show_expanded=True, size=(300,150))],
|
||||
sg.Tree(data=treedata, headings=['col1', 'col2', 'col3'],change_submits=True, auto_size_columns=True, num_rows=10, col0_width=10, key='_TREE_', show_expanded=True, size=(200,150)), sg.Stretch()],
|
||||
]
|
||||
|
||||
graph_elem = sg.Graph((800,150), (0,0), (800,300), key='+GRAPH+')
|
||||
graph_elem = sg.Graph((880,150), (0,0), (600,300), key='+GRAPH+')
|
||||
|
||||
frame6 = [
|
||||
[graph_elem],
|
||||
[graph_elem, sg.Stretch()],
|
||||
]
|
||||
|
||||
tab1 = sg.Tab('Graph Number 1',frame6)
|
||||
|
@ -65,32 +66,46 @@ def main():
|
|||
[sg.Menu(menu_def)],
|
||||
[sg.Image(data_base64=logo),sg.Frame('Input Text Group', frame1, title_color='red'), sg.Stretch()],
|
||||
[sg.Frame('Multiple Choice Group', frame2, title_color='green'),
|
||||
sg.Frame('Binary Choice Group', frame3, title_color='purple'), sg.Frame('Variable Choice Group', frame4, title_color='blue'),sg.Stretch()],
|
||||
sg.Frame('Binary Choice Group', frame3, title_color='purple'),
|
||||
sg.Frame('Variable Choice Group', frame4, title_color='blue'),sg.Stretch()],
|
||||
[sg.Frame('Structured Data Group', frame5, title_color='red'), ],
|
||||
# [sg.Frame('Graphing Group', frame6)],
|
||||
[sg.TabGroup([[tab1,tab2]])],
|
||||
[sg.ProgressBar(max_value=800, start_value=400, size=(600,25), key='+PROGRESS+'), sg.Stretch(), sg.Button('Button'), sg.Button('Exit')],
|
||||
[sg.ProgressBar(max_value=600, start_value=400, size=(600,25), key='+PROGRESS+'), sg.Stretch(),
|
||||
sg.ButtonMenu('&Menu', ['Menu', ['&Pause Graph', 'Menu item']], key='_MENU_'),
|
||||
sg.Button('Button'), sg.Button('Exit')],
|
||||
]
|
||||
|
||||
|
||||
window = sg.Window('Window Title',
|
||||
font=('Helvetica', 13)).Layout(layout).Finalize()
|
||||
font=('Helvetica', 13),
|
||||
default_button_element_size=(100,30),
|
||||
auto_size_buttons=False,
|
||||
default_element_size=(200,22)
|
||||
).Layout(layout).Finalize()
|
||||
graph_elem.DrawCircle((200,200), 50, 'blue')
|
||||
i=0
|
||||
graph_paused = False
|
||||
while True: # Event Loop
|
||||
# sg.TimerStart()
|
||||
event, values = window.Read(timeout=0)
|
||||
# print(event, values)
|
||||
if i < 800:
|
||||
if event is None or event == 'Exit' :
|
||||
break
|
||||
if event == 'Button':
|
||||
print(event, values)
|
||||
if values['_MENU_'] == 'Pause Graph':
|
||||
graph_paused = not graph_paused
|
||||
if not graph_paused:
|
||||
i += 1
|
||||
|
||||
if i < 600:
|
||||
graph_elem.DrawLine((i,0),(i,randint(0,300)), width=1, color='#{:06x}'.format(randint(0,0xffffff)))
|
||||
else:
|
||||
graph_elem.Move(-1,0)
|
||||
graph_elem.DrawLine((i,0),(i,randint(0,300)), width=1, color='#{:06x}'.format(randint(0,0xffffff)))
|
||||
|
||||
window.FindElement('+PROGRESS+').UpdateBar(i%800)
|
||||
if event is None or event == 'Exit':
|
||||
break
|
||||
i += 1
|
||||
window.FindElement('+PROGRESS+').UpdateBar(i%600)
|
||||
|
||||
# sg.TimerStop()
|
||||
window.Close()
|
||||
|
||||
|
|
|
@ -1088,7 +1088,7 @@ class MultilineOutput(Element):
|
|||
# ---------------------------------------------------------------------- #
|
||||
class Text(Element):
|
||||
def __init__(self, text, size=(None, None), auto_size_text=None, click_submits=None, relief=None, font=None,
|
||||
text_color=None, background_color=None, justification=None, pad=None, key=None, tooltip=None):
|
||||
text_color=None, background_color=None, justification=None, pad=None, margins=None, key=None, tooltip=None):
|
||||
'''
|
||||
Text Element
|
||||
:param text:
|
||||
|
@ -1109,6 +1109,7 @@ class Text(Element):
|
|||
self.Justification = justification or 'left'
|
||||
self.Relief = relief
|
||||
self.ClickSubmits = click_submits
|
||||
self.Margins = margins
|
||||
if background_color is None:
|
||||
bg = DEFAULT_TEXT_ELEMENT_BACKGROUND_COLOR
|
||||
else:
|
||||
|
@ -1133,7 +1134,7 @@ class Text(Element):
|
|||
style += 'color: %s;' % text_color
|
||||
if background_color is not None:
|
||||
style += 'background-color: %s;' % background_color
|
||||
print(style)
|
||||
# print(style)
|
||||
self.QT_Label.setStyleSheet(style)
|
||||
if value is not None:
|
||||
self.DisplayText = str(value)
|
||||
|
@ -1396,15 +1397,12 @@ class Button(Element):
|
|||
else:
|
||||
font = DEFAULT_FONT
|
||||
|
||||
style = ''
|
||||
# if font is not None:
|
||||
# style += 'font-family: %s;' % font[0]
|
||||
# style += 'font-size: %spt;' % font[1]
|
||||
style = create_style_from_font(font)
|
||||
if self.Disabled != disabled and disabled is not None:
|
||||
if not disabled: # if enabling buttons, set the color
|
||||
if button_color != (None, None):
|
||||
self.ButtonColor = button_color
|
||||
style = str(self.QT_QPushButton.styleSheet())
|
||||
style += create_style_from_font(font)
|
||||
if self.Disabled != disabled and disabled is not None:
|
||||
if not disabled: # if enabling buttons, set the color
|
||||
style += 'color: %s;' % self.ButtonColor[0]
|
||||
style += 'background-color: %s;' % self.ButtonColor[1]
|
||||
self.Disabled = disabled
|
||||
|
@ -1412,11 +1410,13 @@ class Button(Element):
|
|||
self.QT_QPushButton.setDisabled(True)
|
||||
else:
|
||||
self.QT_QPushButton.setDisabled(False)
|
||||
elif button_color != (None, None):
|
||||
self.ButtonColor = button_color
|
||||
|
||||
if button_color != (None, None):
|
||||
style += 'color: %s;' % self.ButtonColor[0]
|
||||
style += 'background-color: %s;' % self.ButtonColor[1]
|
||||
|
||||
if style != '':
|
||||
# print(style)
|
||||
self.QT_QPushButton.setStyleSheet(style)
|
||||
|
||||
|
||||
|
@ -1483,7 +1483,7 @@ class ButtonMenu(Element):
|
|||
|
||||
|
||||
def QT_MenuItemChosenCallback(self, item_chosen):
|
||||
print('IN BUTTON MENU ITEM CALLBACK', item_chosen)
|
||||
# print('IN BUTTON MENU ITEM CALLBACK', item_chosen)
|
||||
self.Key = item_chosen.replace('&','') # fool the quit function into thinking this was a key
|
||||
element_callback_quit_mainloop(self)
|
||||
|
||||
|
@ -2738,7 +2738,7 @@ class Window:
|
|||
self.NoTitleBar = no_titlebar
|
||||
self.GrabAnywhere = grab_anywhere
|
||||
self.KeepOnTop = keep_on_top
|
||||
self.ForceTopLevel = force_toplevel
|
||||
self.ForcefTopLevel = force_toplevel
|
||||
self.Resizable = resizable
|
||||
self._AlphaChannel = alpha_channel
|
||||
self.Timeout = None
|
||||
|
@ -2863,7 +2863,7 @@ class Window:
|
|||
self.autoclose_timer.stop()
|
||||
self.QT_QMainWindow.close()
|
||||
if self.CurrentlyRunningMainloop:
|
||||
print("quitting window")
|
||||
# print("quitting window")
|
||||
self.QTApplication.exit() # kick the users out of the mainloop
|
||||
|
||||
def Read(self, timeout=None, timeout_key=TIMEOUT_KEY):
|
||||
|
@ -3965,6 +3965,14 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
else:
|
||||
full_element_pad[0], full_element_pad[2] = element.Pad[1]
|
||||
element_pad = full_element_pad
|
||||
|
||||
border_depth = toplevel_win.BorderDepth if toplevel_win.BorderDepth is not None else DEFAULT_BORDER_WIDTH
|
||||
try:
|
||||
if element.BorderWidth is not None:
|
||||
border_depth = element.BorderWidth
|
||||
except:
|
||||
pass
|
||||
|
||||
# ------------------------- COLUMN element ------------------------- #
|
||||
if element_type == ELEM_TYPE_COLUMN:
|
||||
# column_widget = QWidget()
|
||||
|
@ -4008,7 +4016,6 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
element.QT_Label.setFixedHeight(element_size[1])
|
||||
# element.QT_Label.setWordWrap(True)
|
||||
style = create_style_from_font(font)
|
||||
|
||||
if element.TextColor is not None and element.TextColor != COLOR_SYSTEM_DEFAULT:
|
||||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||
|
@ -4026,6 +4033,11 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
elif element.Relief == RELIEF_FLAT:
|
||||
qlabel.setFrameStyle(QFrame.Panel | QFrame.NoFrame)
|
||||
|
||||
if element.Margins is not None:
|
||||
m = element.Margins
|
||||
qlabel.setContentsMargins(m[0], m[2], m[1], m[3]) # L T B R
|
||||
|
||||
|
||||
if element.Tooltip:
|
||||
element.QT_Label.setToolTip(element.Tooltip)
|
||||
qt_row_layout.addWidget(element.QT_Label)
|
||||
|
@ -4041,7 +4053,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
if element.BorderWidth == 0:
|
||||
style += 'border: none;'
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_QPushButton.setStyleSheet(style)
|
||||
if (element.AutoSizeButton is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None) and element.ImageData is None:
|
||||
if element_size[0] is not None:
|
||||
|
@ -4080,7 +4093,9 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
|
||||
element.QT_QLineEdit.setStyleSheet(style)
|
||||
|
||||
if element.AutoSizeText is False or toplevel_win.AutoSizeText is False or element.Size[0] is not None:
|
||||
|
@ -4121,7 +4136,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_ComboBox.setStyleSheet(style)
|
||||
|
||||
if not auto_size_text:
|
||||
|
@ -4150,7 +4166,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_ListWidget.setStyleSheet(style)
|
||||
if not auto_size_text:
|
||||
if element_size[0] is not None:
|
||||
|
@ -4183,7 +4200,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_TextEdit.setStyleSheet(style)
|
||||
|
||||
if element.AutoSizeText is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None:
|
||||
|
@ -4220,7 +4238,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_TextBrowser.setStyleSheet(style)
|
||||
|
||||
if element.AutoSizeText is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None:
|
||||
|
@ -4245,7 +4264,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
element.QT_Checkbox.setStyleSheet(style)
|
||||
|
||||
if element.AutoSizeText is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None:
|
||||
|
@ -4271,7 +4290,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
element.QT_QProgressBar.setValue(element.StartValue)
|
||||
|
||||
style = ''
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_QProgressBar.setStyleSheet(style)
|
||||
|
||||
|
||||
|
@ -4289,7 +4309,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
element.QT_Radio_Button.setStyleSheet(style)
|
||||
|
||||
if element.AutoSizeText is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None:
|
||||
|
@ -4319,7 +4339,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_Spinner.setStyleSheet(style)
|
||||
element.QT_Spinner.setRange(element.Values[0], element.Values[1])
|
||||
if not auto_size_text:
|
||||
|
@ -4341,7 +4362,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_TextBrowser.setStyleSheet(style)
|
||||
|
||||
if element.AutoSizeText is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None:
|
||||
|
@ -4379,7 +4401,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
|
||||
element.QT_QLabel = qlabel
|
||||
style = ''
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
element.QT_QLabel.setStyleSheet(style)
|
||||
|
||||
qt_row_layout.addWidget(element.QT_QLabel)
|
||||
|
@ -4395,7 +4417,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
element.QT_QGraphicsScene.setSceneRect(0,0,element.CanvasSize[0],element.CanvasSize[1])
|
||||
element.QT_QGraphicsView.setScene(element.QT_QGraphicsScene)
|
||||
style = ''
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
element.QT_QGraphicsView.setStyleSheet(style)
|
||||
|
||||
qgraphicsview.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
|
@ -4429,7 +4451,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
if element.BorderWidth == 0:
|
||||
style += 'border: none;'
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_QPushButton.setStyleSheet(style)
|
||||
if (element.AutoSizeButton is False or toplevel_win.AutoSizeButtons is False or element.Size[0] is not None) and element.ImageData is None:
|
||||
if element_size[0] is not None:
|
||||
|
@ -4469,7 +4492,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
# style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
# style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
column_widget.setStyleSheet(style)
|
||||
|
||||
column_widget.setTitle(element.Title)
|
||||
|
@ -4489,7 +4512,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'border: 0px solid gray; '
|
||||
# style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
# style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
tab_widget.setStyleSheet(style)
|
||||
|
||||
column_layout = QFormLayout()
|
||||
|
@ -4525,7 +4548,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style = create_style_from_font(font)
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_Slider.setStyleSheet(style)
|
||||
|
||||
element.QT_Slider.setMinimum(element.Range[0])
|
||||
|
@ -4567,7 +4591,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style = create_style_from_font(font)
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_Dial.setStyleSheet(style)
|
||||
|
||||
|
||||
|
@ -4602,7 +4627,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_TableWidget.setStyleSheet(style)
|
||||
|
||||
if element.ChangeSubmits:
|
||||
|
@ -4663,7 +4689,8 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
add_treeview_data(element.TreeData.root_node, element.QT_QTreeWidget)
|
||||
|
||||
style = ''
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
style += 'border: {}px solid gray; '.format(border_depth)
|
||||
element.QT_QTreeWidget.setStyleSheet(style)
|
||||
|
||||
if element.ShowExpanded:
|
||||
|
@ -4685,7 +4712,7 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
|
|||
style += 'color: %s;' % element.TextColor
|
||||
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||
style += 'background-color: %s;' % element.BackgroundColor
|
||||
style += 'margin: {}px {}px {}px {}px'.format(*full_element_pad)
|
||||
style += 'margin: {}px {}px {}px {}px;'.format(*full_element_pad)
|
||||
element.QT_Label.setStyleSheet(style)
|
||||
|
||||
qlabel.setFrameStyle(QFrame.VLine if element.Orientation[0] =='v' else QFrame.HLine)
|
||||
|
|
Loading…
Reference in New Issue