Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, title):
self.text=''
super(ReportDialog, self).__init__(title,'',width=600,height=500,confirm_name='Done')
self.textb = gui.TextInput(width=550,height=400,single_line=False)
self.append_field(self.textb,'text')
def __init__(self, *args):
super(Options, self).__init__(title='Edit Options',width=450,height=300,confirm_name='Ok',cancel_name='Cancel')
# build the gui in _init as it is subclassed
home_dir_field= gui.TextInput(width=250, height=30)
self.append_field_with_label('Pi Presents Data Home:',home_dir_field,key='home_dir')
media_dir_field= gui.TextInput(width=250, height=30)
self.append_field_with_label('Inital directory for Media:',media_dir_field,key='media_dir')
offset_field= gui.TextInput(width=250, height=30)
self.append_field_with_label('Offset for Current Profiles:',offset_field,key='offset')
error_field= gui.Label('',width=400, height=30)
self.append_field(error_field,'error')
# the arguments are width - height - layoutOrientationOrizontal
subContainerRight = gui.Widget(
style={'width': '220px', 'display': 'block',
'overflow': 'auto', 'text-align': 'center'})
self.count = 0
self.counter = gui.Label('', width=200, height=30, margin='10px')
self.lbl = gui.Label('This is a LABEL!', width=200,
height=30, margin='10px')
self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
# setting the listener for the onclick event of the button
self.bt.onclick.connect(self.on_button_pressed)
self.txt = gui.TextInput(width=200, height=30, margin='10px')
self.txt.set_text('This is a TEXTAREA')
self.txt.onchange.connect(self.on_text_area_change)
self.spin = gui.SpinBox(1, 0, 100, width=200, height=30, margin='10px')
self.spin.onchange.connect(self.on_spin_change)
self.progress = gui.Progress(1, 100, width=200, height=5)
self.check = gui.CheckBoxLabel(
'Label checkbox', True, width=200, height=30, margin='10px')
self.check.onchange.connect(self.on_check_change)
self.btInputDiag = gui.Button(
'Open InputDialog', width=200, height=30, margin='10px')
self.btInputDiag.onclick.connect(self.open_input_dialog)
confirm_name='OK',cancel_name='Cancel')
self.append_label(gui.Label('This Unit',width=250,height=30))
e_this_unit_name_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('OSC Name of This Unit:',e_this_unit_name_field,key='e_this_unit_name')
e_this_unit_ip_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('IP of This Unit:',e_this_unit_ip_field,key='e_this_unit_ip')
#SLAVE
self.append_label(gui.Label('OSC Slave',width=250,height=30))
e_slave_enabled_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('OSC Slave enabled (yes/no):',e_slave_enabled_field,key='e_slave_enabled')
e_listen_port_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('Port for listening to commands for this Unit',e_listen_port_field,key='e_listen_port')
# MASTER
self.append_label(gui.Label('OSC Master',width=250,height=30))
e_master_enabled_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('OSC Master enabled (yes/no):',e_master_enabled_field,key='e_master_enabled')
e_reply_listen_port_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('Listen to replies from Slave Unit on Port:',e_reply_listen_port_field,key='e_reply_listen_port')
e_slave_units_name_field = gui.TextInput(width=250,height=30)
self.append_field_with_label('Slave Units OSC Name:',e_slave_units_name_field,key='e_slave_units_name')
self.pp_profiles_dir = pp_profiles_dir
self.callback=callback
self.read_options()
# self.options_manager_dialog.style['background-color'] = 'LightGray'
self.media_field= gui.TextInput(single_line=True,width=250, height=30)
self.media_field.set_text(self.media_offset)
self.append_field_with_label('Media Offset',self.media_field,
None,width=dialog_width-20,key='media_field')
self.livetracks_field= gui.TextInput(single_line=True,width=250, height=30)
self.livetracks_field.set_text(self.livetracks_offset)
self.append_field_with_label('Live Tracks Offset',self.livetracks_field,
None,width=dialog_width-20,key='livetracks_field')
self.profiles_field= gui.TextInput(single_line=True,width=250, height=30)
self.profiles_field.set_text(self.pp_profiles_offset)
self.append_field_with_label('Profiles Offset',self.profiles_field,
None,width=dialog_width-20,key='profiles_field')
self.options_field= gui.TextInput(single_line=True,width=250, height=30)
self.options_field.set_text(self.pp_options)
self.append_field_with_label('Pi Presents Options',self.options_field,
None,width=dialog_width-20,key='options_field')
# the arguments are width - height - layoutOrientationOrizontal
subContainerRight = gui.Container()
subContainerRight.style['width'] = '220px'
subContainerRight.style['display'] = 'block'
subContainerRight.style['overflow'] = 'auto'
subContainerRight.style['text-align'] = 'center'
self.count = 0
self.counter = gui.Label('', width=200, height=30, margin='10px')
self.lbl = gui.Label('This is a LABEL!', width=200, height=90, margin='10px')
self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
# setting the listener for the onclick event of the button
self.bt.set_on_click_listener(self.on_button_pressed)
self.txt = gui.TextInput(width=200, height=30, margin='10px')
self.txt.set_text('This is a TEXTAREA')
self.txt.set_on_change_listener(self.on_text_area_change)
self.spin = gui.SpinBox(100, width=200, height=30, margin='10px')
self.spin.set_on_change_listener(self.on_spin_change)
self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px')
self.check.set_on_change_listener(self.on_check_change)
self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px')
self.btInputDiag.set_on_click_listener(self.open_input_dialog)
self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px')
self.btFileDiag.set_on_click_listener(self.open_fileselection_dialog)
self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px')
# the arguments are width - height - layoutOrientationOrizontal
subContainerRight = gui.Widget()
subContainerRight.style['width'] = '220px'
subContainerRight.style['display'] = 'block'
subContainerRight.style['overflow'] = 'auto'
subContainerRight.style['text-align'] = 'center'
self.count = 0
self.counter = gui.Label('', width=200, height=30, margin='10px')
self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px')
self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
# setting the listener for the onclick event of the button
self.bt.set_on_click_listener(self, 'on_button_pressed')
self.txt = gui.TextInput(width=200, height=30, margin='10px')
self.txt.set_text('This is a TEXTAREA')
self.txt.set_on_change_listener(self, 'on_text_area_change')
self.spin = gui.SpinBox(100, width=200, height=30, margin='10px')
self.spin.set_on_change_listener(self, 'on_spin_change')
self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px')
self.check.set_on_change_listener(self, 'on_check_change')
self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px')
self.btInputDiag.set_on_click_listener(self, 'open_input_dialog')
self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px')
self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog')
self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px')
def __init__(self, title,file_dir,filename,callback):
self.filename=filename
self.file_dir=file_dir
self.callback=callback
self.width=400
self.height=200
super(RenameDialog, self).__init__(title,'',width=self.width,height=self.height,
confirm_name='Ok',cancel_name='Cancel')
self.spacer=gui.Label('',width=400, height=30)
self.append_field(self.spacer,key='spacer')
self.name_field=gui.TextInput(single_line=True,width=self.width-100,height=30)
self.name_field.set_text(self.filename)
self.append_field(self.name_field,'name_field')
def menu_dialog_clicked(self, widget):
self.dialog = gui.GenericDialog(title='Dialog Box', message='Click Ok to transfer content to main page', width='500px')
self.dtextinput = gui.TextInput(width=200, height=30)
self.dtextinput.set_value('Initial Text')
self.dialog.add_field_with_label('dtextinput', 'Text Input', self.dtextinput)
self.dcheck = gui.CheckBox(False, width=200, height=30)
self.dialog.add_field_with_label('dcheck', 'Label Checkbox', self.dcheck)
values = ('Danny Young', 'Christine Holand', 'Lars Gordon', 'Roberto Robitaille')
self.dlistView = gui.ListView.new_from_list(values, width=200, height=120)
self.dialog.add_field_with_label('dlistView', 'Listview', self.dlistView)
self.ddropdown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'),
width=200, height=20)
self.dialog.add_field_with_label('ddropdown', 'Dropdown', self.ddropdown)
self.dspinbox = gui.SpinBox(min=0, max=5000, width=200, height=20)
self.dspinbox.set_value(50)
self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)
def menu_dialog_clicked(self, widget):
self.dialog = gui.GenericDialog(title='Dialog Box', message='Click Ok to transfer content to main page', width='500px')
self.dtextinput = gui.TextInput(width=200, height=30)
self.dtextinput.set_value('Initial Text')
self.dialog.add_field_with_label('dtextinput', 'Text Input', self.dtextinput)
self.dcheck = gui.CheckBox(False, width=200, height=30)
self.dialog.add_field_with_label('dcheck', 'Label Checkbox', self.dcheck)
values = ('Danny Young', 'Christine Holand', 'Lars Gordon', 'Roberto Robitaille')
self.dlistView = gui.ListView.new_from_list(values, width=200, height=120)
self.dialog.add_field_with_label('dlistView', 'Listview', self.dlistView)
self.ddropdown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'),
width=200, height=20)
self.dialog.add_field_with_label('ddropdown', 'Dropdown', self.ddropdown)
self.dspinbox = gui.SpinBox(min=0, max=5000, width=200, height=20)
self.dspinbox.set_value(50)
self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)