Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(self):
#creating a container VBox type, vertical (you can use also HBox or Widget)
main_container = gui.Widget(width=300, style={'margin':'0px auto'}, layout_orientation=gui.Widget.LAYOUT_VERTICAL)
m11 = gui.MenuItem('Save', [gui.MenuItem('Save'), gui.MenuItem('Save as')], width=100, height=30)
m1 = gui.MenuItem('File', [m11, gui.MenuItem('Open')], width=100, height=30)
menu = gui.Menu([m1, gui.MenuItem('View', width=100, height=30), gui.MenuItem('Dialog', width=100, height=30)], width='100%', height='30px')
menubar = gui.MenuBar(width='100%', height='30px')
menubar.append(menu)
listview = gui.ListView(children={'0': gui.ListItem('zero'), 'n': 'n'})
print( listview.append({'1': gui.ListItem('uno'), '2': gui.ListItem('due')}) )
print( listview.append([gui.ListItem('tre'), gui.ListItem('quattro')]) )
dropdown = gui.DropDown({'0': gui.DropDownItem('zero'), 'n': gui.DropDownItem('n')})
print( dropdown.append({'1': gui.DropDownItem('uno'), '2': gui.DropDownItem('due')}) )
print( dropdown.append(['tre', 'quattro']) )
table = gui.Table({'0': gui.TableRow(['zero','zeroo','zerooo']), 'n':gui.TableRow(['n','nn','nnn'])})
print( table.append({'1': gui.TableRow(['uno','unoo','unooo']), '2':gui.TableRow(['due','duee','dueee'])}) )
row3 = gui.TableRow()
row3.append(['tre','tree','treee'])
livetracks_menu = gui.MenuItem('Live Tracks',width=miw, height=30)
livetracks_import_menu = gui.MenuItem('Import',width=miw, height=30)
livetracks_upload_menu = gui.MenuItem('Upload',width=miw, height=30)
livetracks_import_menu.set_on_click_listener(self.on_livetracks_import_clicked)
livetracks_upload_menu.set_on_click_listener(self.on_livetracks_upload_clicked)
livetracks_manage_menu = gui.MenuItem('Manage',width=miw, height=30)
livetracks_manage_menu.set_on_click_listener(self.on_livetracks_manage_clicked)
#profile menu
profile_menu = gui.MenuItem( 'Profile',width=miw, height=30)
profile_import_menu = gui.MenuItem('Import',width=miw, height=30)
profile_import_menu.set_on_click_listener(self.on_profile_import_clicked)
profile_upload_menu = gui.MenuItem('Upload',width=miw, height=30)
profile_upload_menu.set_on_click_listener(self.on_profile_upload_clicked)
profile_download_menu = gui.MenuItem('Download',width=miw, height=30)
profile_download_menu.set_on_click_listener(self.on_profile_download_clicked)
profile_manage_menu = gui.MenuItem('Manage',width=miw, height=30)
profile_manage_menu.set_on_click_listener(self.on_profiles_manage_clicked)
#logs menu
logs_menu = gui.MenuItem( 'Logs',width=miw, height=30)
log_download_menu = gui.MenuItem('Download Log',width=miw + 80, height=30)
log_download_menu.set_on_click_listener(self.on_log_download_clicked)
stats_download_menu = gui.MenuItem('Download Stats',width=miw + 80, height=30)
stats_download_menu.set_on_click_listener(self.on_stats_download_clicked)
# editor menu
editor_menu=gui.MenuItem('Editor',width=miw,height=30)
editor_run_menu=gui.MenuItem('Run',width=miw,height=30)
editor_run_menu.set_on_click_listener(self.on_editor_run_menu_clicked)
editor_exit_menu=gui.MenuItem('Exit',width=miw,height=30)
pmenu = gui.MenuItem('Exhibit',width=150, height=30)
pmenu.set_on_click_listener(self.new_exhibit_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Media Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_mediashow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Art Media Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_artmediashow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Menu',width=150, height=30)
pmenu.set_on_click_listener(self.new_menu_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Presentation',width=150, height=30)
pmenu.set_on_click_listener(self.new_presentation_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Interactive',width=150, height=30)
pmenu.set_on_click_listener(self.new_interactive_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Live Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_liveshow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Art Live Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_artliveshow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('RadioButton Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_radiobuttonshow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem( 'Hyperlink Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_hyperlinkshow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem( 'Blank',width=150, height=30)
pmenu.set_on_click_listener(self.new_blank_profile)
#menu
menubar=gui.MenuBar(width='100%', height='30px')
menu = gui.Menu(width='100%', height='30px')
#profile menu
profile_menu = gui.MenuItem('Profile',width=80, height=30)
profile_open_menu = gui.MenuItem('Open',width=120, height=30)
profile_open_menu.set_on_click_listener(self.open_existing_profile)
profile_validate_menu = gui.MenuItem('Validate',width=120, height=30)
profile_validate_menu.set_on_click_listener(self.validate_profile)
profile_copy_to_menu = gui.MenuItem( 'Copy To',width=120, height=30)
profile_copy_to_menu.set_on_click_listener(self.copy_profile)
profile_delete_menu = gui.MenuItem( 'Delete',width=120, height=30)
profile_delete_menu.set_on_click_listener(self.delete_profile)
profile_new_menu = gui.MenuItem('New',width=120, height=30)
profile_menu.append(profile_open_menu)
profile_menu.append(profile_validate_menu)
profile_menu.append(profile_copy_to_menu)
profile_menu.append(profile_delete_menu)
profile_menu.append(profile_new_menu)
pmenu = gui.MenuItem('Exhibit',width=150, height=30)
pmenu.set_on_click_listener(self.new_exhibit_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Media Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_mediashow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Art Media Show',width=150, height=30)
pmenu.set_on_click_listener(self.new_artmediashow_profile)
profile_new_menu.append(pmenu)
pmenu = gui.MenuItem('Menu',width=150, height=30)
stats_download_menu = gui.MenuItem('Download Stats',width=miw + 80, height=30)
stats_download_menu.set_on_click_listener(self.on_stats_download_clicked)
# editor menu
editor_menu=gui.MenuItem('Editor',width=miw,height=30)
editor_run_menu=gui.MenuItem('Run',width=miw,height=30)
editor_run_menu.set_on_click_listener(self.on_editor_run_menu_clicked)
editor_exit_menu=gui.MenuItem('Exit',width=miw,height=30)
editor_exit_menu.set_on_click_listener(self.on_editor_exit_menu_clicked)
#options menu
options_menu=gui.MenuItem('Options',width=miw,height=30)
options_manager_menu=gui.MenuItem('Manager',width=miw,height=30)
options_manager_menu.set_on_click_listener(self.on_options_manager_menu_clicked)
options_autostart_menu=gui.MenuItem('Autostart',width=miw,height=30)
options_autostart_menu.set_on_click_listener(self.on_options_autostart_menu_clicked)
options_email_menu=gui.MenuItem('Email',width=miw,height=30)
options_email_menu.set_on_click_listener(self.on_options_email_menu_clicked)
# Pi menu
pi_menu=gui.MenuItem('Pi',width=miw,height=30)
pi_reboot_menu=gui.MenuItem('Reboot',width=miw,height=30)
pi_reboot_menu.set_on_click_listener(self.pi_reboot_menu_clicked)
pi_shutdown_menu=gui.MenuItem('Shutdown',width=miw,height=30)
pi_shutdown_menu.set_on_click_listener(self.pi_shutdown_menu_clicked)
# list of profiles
self.profile_list = gui.ListView(width=250, height=300)
self.profile_list.set_on_selection_listener(self.on_profile_selected)
# use a defined key as we replace this widget later
fdownloader = gui.FileDownloader(
'download test', '../remi/res/logo.png', width=200, height=30, margin='10px')
subContainerRight.append(fdownloader, key='file_downloader')
subContainerRight.append(
[self.btUploadFile, self.dropDown, self.slider, self.colorPicker, self.date, self.tree])
self.subContainerRight = subContainerRight
subContainerLeft.append(
[self.img, self.table, self.listView, self.link, self.video])
horizontalContainer.append([subContainerLeft, subContainerRight])
menu = gui.Menu(width='100%', height='30px')
m1 = gui.MenuItem('File', width=100, height=30)
m2 = gui.MenuItem('View', width=100, height=30)
m2.onclick.connect(self.menu_view_clicked)
m11 = gui.MenuItem('Save', width=100, height=30)
m12 = gui.MenuItem('Open', width=100, height=30)
m12.onclick.connect(self.menu_open_clicked)
m111 = gui.MenuItem('Save', width=100, height=30)
m111.onclick.connect(self.menu_save_clicked)
m112 = gui.MenuItem('Save as', width=100, height=30)
m112.onclick.connect(self.menu_saveas_clicked)
m3 = gui.MenuItem('Dialog', width=100, height=30)
m3.onclick.connect(self.menu_dialog_clicked)
menu.append([m1, m2, m3])
m1.append([m11, m12])
m11.append([m111, m112])
menubar = gui.MenuBar(width='100%', height='30px')
log_download_menu = gui.MenuItem('Download Log',width=miw + 80, height=30)
log_download_menu.set_on_click_listener(self.on_log_download_clicked)
stats_download_menu = gui.MenuItem('Download Stats',width=miw + 80, height=30)
stats_download_menu.set_on_click_listener(self.on_stats_download_clicked)
# editor menu
editor_menu=gui.MenuItem('Editor',width=miw,height=30)
editor_run_menu=gui.MenuItem('Run',width=miw,height=30)
editor_run_menu.set_on_click_listener(self.on_editor_run_menu_clicked)
editor_exit_menu=gui.MenuItem('Exit',width=miw,height=30)
editor_exit_menu.set_on_click_listener(self.on_editor_exit_menu_clicked)
#options menu
options_menu=gui.MenuItem('Options',width=miw,height=30)
options_manager_menu=gui.MenuItem('Manager',width=miw,height=30)
options_manager_menu.set_on_click_listener(self.on_options_manager_menu_clicked)
options_autostart_menu=gui.MenuItem('Autostart',width=miw,height=30)
options_autostart_menu.set_on_click_listener(self.on_options_autostart_menu_clicked)
options_email_menu=gui.MenuItem('Email',width=miw,height=30)
options_email_menu.set_on_click_listener(self.on_options_email_menu_clicked)
# Pi menu
pi_menu=gui.MenuItem('Pi',width=miw,height=30)
pi_reboot_menu=gui.MenuItem('Reboot Pi',width=miw+30,height=30)
pi_reboot_menu.set_on_click_listener(self.pi_reboot_menu_clicked)
pi_shutdown_menu=gui.MenuItem('Shutdown Pi',width=miw+30,height=30)
pi_shutdown_menu.set_on_click_listener(self.pi_shutdown_menu_clicked)
pi_close_manager_menu=gui.MenuItem('Exit PPManager',width=miw+30,height=30)
pi_close_manager_menu.set_on_click_listener(self.pi_close_manager_menu_clicked)
# list of profiles
def __init__(self, text, **kwargs):
"""
Args:
text (str):
kwargs: See Widget.__init__()
"""
super(MenuItem, self).__init__(**kwargs)
self.sub_container = None
self.type = 'li'
self.attributes[self.EVENT_ONCLICK] = ''
self.set_text(text)
subti4.append([subsubti1, subsubti2, subsubti3])
# appending a widget to another, the first argument is a string key
subContainerRight.append([self.counter, self.lbl, self.bt, self.txt, self.spin, self.progress, self.check, self.btInputDiag, self.btFileDiag])
# use a defined key as we replace this widget later
fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px')
subContainerRight.append(fdownloader, key='file_downloader')
subContainerRight.append([self.btUploadFile, self.dropDown, self.slider, self.colorPicker, self.date, self.tree])
self.subContainerRight = subContainerRight
subContainerLeft.append([self.img, self.table, self.listView, self.link, self.video])
horizontalContainer.append([subContainerLeft, subContainerRight])
menu = gui.Menu(width='100%', height='30px')
m1 = gui.MenuItem('File', width=100, height=30)
m2 = gui.MenuItem('View', width=100, height=30)
m2.onclick.do(self.menu_view_clicked)
m11 = gui.MenuItem('Save', width=100, height=30)
m12 = gui.MenuItem('Open', width=100, height=30)
m12.onclick.do(self.menu_open_clicked)
m111 = gui.MenuItem('Save', width=100, height=30)
m111.onclick.do(self.menu_save_clicked)
m112 = gui.MenuItem('Save as', width=100, height=30)
m112.onclick.do(self.menu_saveas_clicked)
m3 = gui.MenuItem('Dialog', width=100, height=30)
m3.onclick.do(self.menu_dialog_clicked)
menu.append([m1, m2, m3])
m1.append([m11, m12])
m11.append([m111, m112])
def main(self):
self.mainContainer = gui.Container(width='100%', height='100%', layout_orientation=gui.Container.LAYOUT_VERTICAL, style={
'background-color': 'white', 'border': 'none', 'overflow': 'hidden'})
menubar = gui.MenuBar(height='4%')
menu = gui.Menu(width='100%', height='100%')
menu.style['z-index'] = '1'
m1 = gui.MenuItem('File', width=150, height='100%')
m10 = gui.MenuItem('New', width=150, height=30)
m11 = gui.MenuItem('Open', width=150, height=30)
m12 = gui.MenuItem('Save Your App', width=150, height=30)
#m12.style['visibility'] = 'hidden'
m121 = gui.MenuItem('Save', width=100, height=30)
m122 = gui.MenuItem('Save as', width=100, height=30)
m123 = gui.MenuItem('Export widget as', width=200, height=30)
m1.append([m10, m11, m12])
m12.append([m121, m122, m123])
m2 = gui.MenuItem('Edit', width=100, height='100%')
m21 = gui.MenuItem('Cut', width=100, height=30)
m22 = gui.MenuItem('Paste', width=100, height=30)
m2.append([m21, m22])
m3 = gui.MenuItem('Project Config', width=200, height='100%')
m4 = gui.MenuItem('Became a Patron', width=200,
height='100%', style={'font-weight': 'bold'})
menu.append([m1, m2, m3, m4])
menubar.append(menu)