Merge pull request #698 from MikeTheWatchGuy/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2018-11-10 17:33:07 -05:00 committed by GitHub
commit f4ad2ce955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 11 deletions

View File

@ -1964,12 +1964,12 @@ class Slider(Element):
def Update(self, value=None, range=(None, None), disabled=None): def Update(self, value=None, range=(None, None), disabled=None):
if value is not None: if value is not None:
pass self.QT_Slider.setValue(int(value))
self.DefaultValue = value self.DefaultValue = value
if disabled == True: if disabled == True:
pass self.QT_Slider.setDisabled(True)
elif disabled == False: elif disabled == False:
pass self.QT_Slider.setDisabled(False)
def SliderChangedHandler(self, event): def SliderChangedHandler(self, event):
# first, get the results table built # first, get the results table built
@ -2236,8 +2236,8 @@ class Table(Element):
return return
def QtCallbackCellActivated(self, value): def QtCallbackCellActivated(self, value=None):
print('CELL ACTIVATED ', value) # print('CELL ACTIVATED ', value)
# first, get the results table built # first, get the results table built
# modify the Results table in the parent FlexForm object # modify the Results table in the parent FlexForm object
if not self.ChangeSubmits: if not self.ChangeSubmits:
@ -2253,6 +2253,13 @@ class Table(Element):
if values is not None: if values is not None:
self.Values = values self.Values = values
self.SelectedRows = [] self.SelectedRows = []
self.QT_TableWidget.clear()
self.QT_TableWidget.setRowCount(len(self.Values))
self.QT_TableWidget.setColumnCount(len(self.Values[0]))
for rownum, rows in enumerate(self.Values):
# self.QT_TableWidget.insertRow(rownum)
for colnum, columns in enumerate(rows):
self.QT_TableWidget.setItem(rownum, colnum, QTableWidgetItem(self.Values[rownum][colnum]))
def treeview_selected(self, event): def treeview_selected(self, event):
if self.ChangeSubmits: if self.ChangeSubmits:
@ -4148,11 +4155,10 @@ def PackFormIntoFrame(window, containing_frame, toplevel_win):
element.QT_TableWidget.setStyleSheet(style) element.QT_TableWidget.setStyleSheet(style)
if element.ChangeSubmits: if element.ChangeSubmits:
element.QT_TableWidget.itemClicked.connect(element.QtCallbackCellActivated) # element.QT_TableWidget.itemClicked.connect(element.QtCallbackCellActivated)
# element.QT_TableWidget.itemActivated.connect(element.QtCallbackCellActivated)
# element.QT_TableWidget.itemEntered.connect(element.QtCallbackCellActivated)
element.QT_TableWidget.itemSelectionChanged.connect(element.QtCallbackCellActivated) element.QT_TableWidget.itemSelectionChanged.connect(element.QtCallbackCellActivated)
# QObject::connect(ui->table->verticalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT( termSelect(int)));
element.QT_TableWidget.verticalHeader().connect(element.QtCallbackVerticalHeader)
element.QT_TableWidget.setRowCount(len(element.Values)) element.QT_TableWidget.setRowCount(len(element.Values))
element.QT_TableWidget.setColumnCount(len(element.Values[0])) element.QT_TableWidget.setColumnCount(len(element.Values[0]))
for rownum, rows in enumerate(element.Values): for rownum, rows in enumerate(element.Values):

View File

@ -2,7 +2,11 @@ import PySimpleGUIQt as sg
layout = [ layout = [
[sg.Text('This is the new Dial Element!')], [sg.Text('This is the new Dial Element!')],
[sg.Dial(range=(1,100), key='_DIAL_')], [sg.T(' ', size=(70,10)), sg.T('0', key='+DIAL_VALUE+', font=('Helvetica', 15))],
[sg.Dial(range=(1,100), key='_DIAL_', change_submits=True)],
[sg.Slider((1,100), orientation='h', key='_SLIDER_', change_submits=True),
sg.T(' 1', key='+SLIDER_VALUE+', font=('Helvetica', 15))],
[sg.T('1' + 30*' ' + '100')],
[sg.Button('Show'), sg.Button('Exit')] [sg.Button('Show'), sg.Button('Exit')]
] ]
@ -10,8 +14,9 @@ window = sg.Window('Window Title').Layout(layout)
while True: # Event Loop while True: # Event Loop
event, values = window.Read() event, values = window.Read()
print(event, values)
if event is None or event == 'Exit': if event is None or event == 'Exit':
break break
window.FindElement('+DIAL_VALUE+').Update(values['_DIAL_'])
window.FindElement('+SLIDER_VALUE+').Update(values['_SLIDER_'])
window.Close() window.Close()

View File

@ -0,0 +1,33 @@
import PySimpleGUIQt as sg
sg.ChangeLookAndFeel('LightGreen')
layout = [
[sg.Text('Widgets Currently Supported By PySimpleGUIQt')],
[sg.Text('Text', size=(200,35)), sg.Text('Text In Any Color/Font', font=('Courier', 15), text_color='red')],
[sg.Text('Single Line Input', size=(200,35)), sg.Input(size=(200,25))],
[sg.Text('Multi Line\nInput/Output', size=(200,60)), sg.Multiline(size=(200,75))],
[sg.Text('ListBox', size=(200,35)),sg.Listbox(['Listbox 1','Listbox 2','Listbox 3'], size=(200,85)) ],
[sg.Text('ComboBox / Dropdown', size=(200,25)),sg.Combo(['Combo item 1',], size=(200,35)) ],
[sg.Text('Spinner', size=(200,35)),sg.Spin([1,2,3], size=(40,30)) ],
[sg.Text('Checkbox', size=(200,35)), sg.Checkbox('Checkbox', change_submits=True) ],
[sg.Text('RadioButton', size=(200,35)), sg.Radio('Radio Button', 1) ],
[sg.Text('Slider', size=(200,35)), sg.Slider(orientation='h') ],
[sg.Text('Button', size=(200,35)), sg.Button('Button') ],
[sg.Text('Table', size=(200,35)), sg.Table([[0,1,3,4]])],
[sg.Text('Frame', size=(200,35)), sg.Frame('Frame',[[sg.T('')],[sg.T('')]])],
[sg.Text('Stdout Output', size=(200,35)), sg.Output(size=(200,75)) ],
[sg.Text('Dial', size=(200,35)),sg.Dial(size=(150,75)), sg.Stretch() ],
[sg.Button('Blank'), sg.Button('Exit')]
]
window = sg.Window('Window Title',
font=('Helvetica', 13)).Layout(layout)
while True: # Event Loop
event, values = window.Read()
print(event, values)
if event is None or event == 'Exit':
break
window.Close()