示例#1
0
 def __init__(self, self_pointer, **kwargs):
     super(ComponentImporter, self).__init__(**kwargs)
     self_pointer.canvas.empty()
     self_pointer.canvas.append(gui.Label('Component Importer'))
     self.component_list = gui.ListView()
     self.lazy_load_component_list(self_pointer)
     self_pointer.canvas.append(EditorButton(text='Import', icon='add'))
示例#2
0
    def __init__(self, appInstance, **kwargs):
        super(WorkflowWidget, self).__init__(**kwargs)

        self._appInstance = appInstance
        self.paramsWidget = None

        self.lblTitle = gui.Label("Workflow editor")
        self.lblTitle.add_class("DialogTitle")

        self.createMainMenu()
        self.listView = gui.ListView(width='100%', height='85%')
        self.listView.style['left'] = '0%'
        self.listView.style['overflow-y'] = 'scroll'
        self.listView.style['overflow-x'] = 'hidden'
        self.listView.style['flex-wrap'] = 'wrap'
        self.listView.style['background-color'] = 'white'

        self._moduleList = ModuleList(self.listView, appInstance)

#        self.style['margin'] = '0px'

        self.append(self.lblTitle)
        self.append(self.listView)

        self.listView.set_on_selection_listener(self.moduleSelected)
示例#3
0
    def main(self):
        self.users = []
        self.save_location = "data.pickle"

        container = gui.Widget(width=500, margin="0px auto")

        menu = gui.Menu(width="100%", height="30px")

        menu_file = gui.MenuItem("File", width=100, height=30)
        menu_load = gui.MenuItem("Load...", width=100, height=30)
        menu_load.set_on_click_listener(self.cbk_select_pickle)
        menu_save = gui.MenuItem("Save", width=100, height=30)
        menu_save.set_on_click_listener(self.cbk_save)
        menu_save_as = gui.MenuItem("Save As...", width=100, height=30)
        menu_save_as.set_on_click_listener(self.cbk_save_as)

        menu.append(menu_file)
        menu_file.append(menu_load)
        menu_file.append(menu_save)
        menu_file.append(menu_save_as)

        menubar = gui.MenuBar(width="100%", height="30px")
        menubar.append(menu)

        self.uploader = gui.FileUploader("./", margin="10px")
        self.uploader.set_on_success_listener(self.cbk_load)

        self.save_location_label = gui.Label(f"Saving to {self.save_location}", margin="10px")

        self.table = gui.Table.new_from_list([("ID", "Name", "Onboard", "SPIRIT", "Both")],
            width=300, margin="10px")

        select_user_label = gui.Label("Select a user:"******"10px")
        self.user_list = gui.ListView(margin="10px", width=300)
        self.user_list.set_on_selection_listener(self.cbk_user_selected)

        add_user_button = gui.Button("Add user", width=200, height=30, margin="10px")
        add_user_button.set_on_click_listener(self.cbk_add_user)

        save_button = gui.Button("Save", width=200, height=30, margin="10px")
        save_button.set_on_click_listener(self.cbk_save)

        try:
            self._load(self.save_location)
        except FileNotFoundError:
            pass
        self.update_table()
        self.update_user_list()

        container.append(menubar)
        container.append(self.uploader)
        container.append(self.save_location_label)
        container.append(self.table)
        container.append(select_user_label)
        container.append(self.user_list)
        container.append(add_user_button)
        container.append(save_button)

        return container
示例#4
0
 def Define_log_sheet(self):
     ''' Define a tab and frame for errors and warnings'''
     log_head = ['Messages and warnings', 'Berichten en foutmeldingen']
     self.log_frame = gui.ListView(width='100%',
                                   height='100%',
                                   style='background-color:#eeffdd')
     self.log_frame.attributes['title'] = 'Display messages and warnings'
     self.views_noteb.add_tab(self.log_frame, log_head[self.GUI_lang_index],
                              self.tab_cb)
示例#5
0
    def menu_dialog_clicked(self):
        self.dialog = gui.GenericDialog(
            title='Dialog Box',
            message='Click Ok to transfer content to main page')

        self.dtextinput = gui.TextInput(200, 30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input',
                                         self.dtextinput)

        self.dcheck = gui.CheckBox(200, 30, False)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox',
                                         self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon',
                  'Roberto Robitaille')
        self.dlistView = gui.ListView(200, 120)
        key = 0
        for value in values:
            obj = gui.ListItem(170, 20, value)
            self.dlistView.append(str(key), obj)
            key += 1
        self.dialog.add_field_with_label('dlistView', 'Listview',
                                         self.dlistView)

        self.ddropdown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.ddropdown.append('0', c0)
        self.ddropdown.append('1', c1)
        self.ddropdown.set_value('Value1')
        self.dialog.add_field_with_label('ddropdown', 'Dropdown',
                                         self.ddropdown)

        self.dspinbox = gui.SpinBox(200, 20, min=0, max=5000)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(200, 20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker',
                                         self.dcolor)

        self.ddate = gui.Date(
            200,
            20,
        )
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.set_on_confirm_dialog_listener(self, 'dialog_confirm')
        self.dialog.show(self)
示例#6
0
    def __init__(self, appInstance, **kwargs):
        self.appInstance = appInstance
        super(WidgetCollection, self).__init__(**kwargs)

        self.lblTitle = gui.Label("Widgets Toolbox")
        self.listWidgets = gui.ListView(width='100%', height='85%')
        self.listWidgets.style['overflow-y'] = 'scroll'
        self.listWidgets.style['overflow-x'] = 'hidden'

        self.append(self.lblTitle)
        self.append(self.listWidgets)

        #load all widgets
        self.add_widget_to_collection(gui.HBox, width='250px', height='250px')
        self.add_widget_to_collection(gui.VBox, width='250px', height='250px')
        self.add_widget_to_collection(gui.Widget,
                                      width='250px',
                                      height='250px')
        self.add_widget_to_collection(gui.Button, width='100px', height='30px')
        self.add_widget_to_collection(gui.TextInput,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.Label, width='100px', height='30px')
        self.add_widget_to_collection(gui.ListView,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.ListItem,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.DropDown,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.DropDownItem,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.Image, width='100px', height='100px')
        self.add_widget_to_collection(gui.CheckBoxLabel,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.CheckBox,
                                      width='30px',
                                      height='30px')
        self.add_widget_to_collection(gui.SpinBox,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.Slider, width='100px', height='30px')
        self.add_widget_to_collection(gui.ColorPicker,
                                      width='100px',
                                      height='30px')
        self.add_widget_to_collection(gui.Date, width='100px', height='30px')
        self.add_widget_to_collection(gui.Link, width='100px', height='30px')
        self.add_widget_to_collection(gui.VideoPlayer,
                                      width='100px',
                                      height='100px')
示例#7
0
    def menu_dialog_clicked(self):
        self.dialog = gui.GenericDialog(
            title='Dialog Box',
            message='Click Ok to transfer content to main page')
        self.dialog.style['width'] = '300px'
        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(width=200, height=120)
        for key, value in enumerate(values):
            self.dlistView.append(value, key=str(key))
        self.dialog.add_field_with_label('dlistView', 'Listview',
                                         self.dlistView)

        self.ddropdown = gui.DropDown(width=200, height=20)
        c0 = gui.DropDownItem('DropDownItem 0', width=200, height=20)
        c1 = gui.DropDownItem('DropDownItem 1', width=200, height=20)
        self.ddropdown.append(c0)
        self.ddropdown.append(c1)
        self.ddropdown.set_value('Value1')
        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)

        self.dslider = gui.Slider(10, 0, 100, 5, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(width=200, height=20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker',
                                         self.dcolor)

        self.ddate = gui.Date(width=200, height=20)
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.set_on_confirm_dialog_listener(self, 'dialog_confirm')
        self.dialog.show(self)
    def Define_log_sheet(self):
        ''' Define a mess_frame for errors and warnings'''
        log_head_text = ['Messages and warnings', 'Berichten en foutmeldingen']
        self.mess_frame = gui.VBox(width='100%', height=120,
                                   style={'overflow': 'auto'})
        self.mess_frame.attributes['title'] = 'Display area for messages and warnings'

        self.log_label = gui.Label(log_head_text[self.GUI_lang_index],
                                   width='100%', height=20,
                                   style='background-color:#bbffff')
        self.log_messages = gui.ListView(width='100%', height='100%',
                                         style='background-color:#ddffff')
        self.mess_frame.append(self.log_label)
        self.mess_frame.append(self.log_messages)

        self.main_frame.append(self.mess_frame)
示例#9
0
    def __init__(self, app: 'LessonReplaceBotApp', table: str, field: str,
                 onchange: Callable):
        self.app = app
        self.table = table
        self.field = field
        self.onchange = onchange

        super().__init__(width=ALL, height='92%')
        hbox = gui.HBox(width=ALL, height=ALL)

        left_panel = gui.VBox(width="30%", height=ALL, margin=MARGIN)
        left_panel.css_justify_content = "flex-start"
        right_panel = gui.VBox(width="70%", height=ALL, margin=MARGIN)

        self.text = gui.TextInput('', width=ALL, height=HEIGHT, margin=MARGIN)
        self.add_btn = gui.Button('Добавить',
                                  width=ALL,
                                  height=HEIGHT,
                                  margin=MARGIN)
        self.add_btn.onclick.do(self.on_btn_add_click)
        self.del_btn = gui.Button('Удалить',
                                  width=ALL,
                                  height=HEIGHT,
                                  margin=MARGIN)
        self.del_btn.set_enabled(False)

        left_panel.append(self.text)
        left_panel.append(self.add_btn)
        left_panel.append(self.del_btn)

        self.list_view = gui.ListView(width=ALL, height=ALL, margin=MARGIN)
        self.refresh_list()
        self.list_view.onselection.do(self.list_view_on_selected)
        view_port = gui.Container(width=ALL,
                                  height=ALL,
                                  style={"overflow-y": "scroll"})
        view_port.append(self.list_view)
        right_panel.append(view_port)

        hbox.append(left_panel)
        hbox.append(right_panel)
        self.append(hbox)
示例#10
0
    def __init__(self):
        self.stdouts = []

        self.lst_termout = gui.ListView(style=StdoutBoxStyles["list"],
                                        id="stdoutlist")
示例#11
0
    def initScheduler(self, robot):
        schedulerBox = self.sectionBox()

        controlBox = gui.HBox()
        schedulerBox.append(controlBox)
        manualModeBtn = gui.Button("Manual")
        manualModeBtn.onclick.connect(robot.c_manualMode)
        controlBox.append(manualModeBtn)
        autoModeBtn = gui.Button("Auto")
        autoModeBtn.onclick.connect(robot.c_autoMode)
        controlBox.append(autoModeBtn)

        self.controlModeGroup = sea.ToggleButtonGroup()
        self.controlModeGroup.addButton(manualModeBtn, "manual")
        self.controlModeGroup.addButton(autoModeBtn, "auto")

        hbox = gui.HBox()
        hbox.style['align-items'] = 'flex-start'
        schedulerBox.append(hbox)

        addActionBox = gui.VBox()
        hbox.append(addActionBox)

        self.autoSpeed = 6

        def slowSpeed():
            self.autoSpeed = 3

        def mediumSpeed():
            self.autoSpeed = 6

        def fastSpeed():
            self.autoSpeed = 8

        speedTabBox = gui.TabBox()
        speedTabBox.add_tab(gui.Widget(), "Slow", slowSpeed)
        speedTabBox.add_tab(gui.Widget(), "Med", mediumSpeed)
        speedTabBox.add_tab(gui.Widget(), "Fast", fastSpeed)
        speedTabBox.select_by_index(1)
        addActionBox.append(speedTabBox)

        addActionBox.append(gui.Label("Auto actions:"))

        self.genericActionList = gui.ListView()
        self.genericActionList.append("Drive to Point", "drivetopoint")
        self.genericActionList.append("Navigate to Point", "navigatetopoint")
        self.genericActionList.append("Rotate in place", "rotate")
        index = 0
        for action in robot.genericAutoActions:
            self.genericActionList.append(gui.ListItem(action.name),
                                          str(index))
            index += 1
        self.genericActionList.onselection.connect(self.c_addGenericAction)
        addActionBox.append(self.genericActionList)

        hbox.append(self.spaceBox())

        scheduleListBox = gui.VBox()
        hbox.append(scheduleListBox)
        clearScheduleBox = gui.HBox()
        clearScheduleBox.style['align-items'] = 'flex-end'
        scheduleListBox.append(clearScheduleBox)
        clearScheduleBox.append(gui.Label("Schedule:"))
        clearScheduleBtn = gui.Button("Clear")
        clearScheduleBtn.onclick.connect(self.c_clearSchedule)
        clearScheduleBox.append(clearScheduleBtn)

        self.schedulerList = gui.ListView()
        self.schedulerList.onselection.connect(self.c_removeAction)
        scheduleListBox.append(self.schedulerList)

        schedulePresetLbl = gui.Label("Auto Schedule Presets")
        schedulerBox.append(schedulePresetLbl)
        presetIn = gui.Input(default_value="file name")
        schedulerBox.append(presetIn)
        schedulePresets = gui.HBox()
        schedulerBox.append(schedulePresets)
        self.presetDropdown = gui.DropDown()
        self.updatePresetFileDropdown()
        schedulerBox.append(self.presetDropdown)
        openPresetBtn = gui.Button("Open")
        schedulePresets.append(openPresetBtn)
        openPresetBtn.onclick.connect(self.c_openAutoPreset,
                                      self.presetDropdown)
        newPresetBtn = gui.Button("New")
        schedulePresets.append(newPresetBtn)
        newPresetBtn.onclick.connect(self.c_saveAutoPresetFromText, presetIn)
        schedulePresets.append(newPresetBtn)
        savePresetBtn = gui.Button("Save")
        schedulePresets.append(savePresetBtn)
        savePresetBtn.onclick.connect(self.c_saveAutoPresetFromDropdown,
                                      self.presetDropdown)
        schedulePresets.append(savePresetBtn)
        deletePresetBtn = gui.Button("Delete")
        schedulePresets.append(deletePresetBtn)
        deletePresetBtn.onclick.connect(self.c_deleteAutoPreset,
                                        self.presetDropdown)
        schedulePresets.append(deletePresetBtn)

        return schedulerBox
示例#12
0
    def main(self):
        full = gui.Container(
            width=700,
            height=700,
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL)
        full.style['box-shadow'] = "none"

        screen = gui.Container(width=441, height=700)
        screen.style['box-shadow'] = "none"

        title_container = gui.Container(
            width='100%',
            height=50,
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL)
        black_icon = gui.Container(width=40, height=40)
        black_icon.style['background-image'] = "url('/my_res:black_stone.png')"
        black_icon.style['background-repeat'] = 'no-repeat'
        black_icon.style['background-size'] = '40px 40px'
        black_icon.style['background-color'] = 'transparent'
        black_icon.style['position'] = 'absolute'
        black_icon.style['top'] = "5px"
        black_icon.style['left'] = "5px"
        black_title = gui.Label("You")
        black_title.style['font-family'] = "Courier New"
        black_title.style['position'] = 'absolute'
        black_title.style['font-size'] = "32px"
        black_title.style['padding-top'] = "7px"
        black_title.style['padding-left'] = "50px"
        white_title = gui.Label("BetaGo")
        white_title.style['font-family'] = "Courier New"
        white_title.style['position'] = 'absolute'
        white_title.style['font-size'] = "32px"
        white_title.style['top'] = "7px"
        white_title.style['left'] = "275px"
        white_icon = gui.Container(width=50, height=50)
        white_icon.style['background-image'] = "url('/my_res:white_stone.png')"
        white_icon.style['background-repeat'] = 'no-repeat'
        white_icon.style['background-size'] = '40px 40px'
        white_icon.style['background-color'] = 'transparent'
        white_icon.style['position'] = 'absolute'
        white_icon.style['top'] = "5px"
        white_icon.style['left'] = "396px"
        self.black_score.style['font-family'] = 'Courier New'
        self.black_score.style['color'] = '#ff0066'
        self.black_score.style['font-style'] = 'italic'
        self.black_score.style['position'] = 'absolute'
        self.black_score.style['font-size'] = '22px'
        self.black_score.style['top'] = '13px'
        self.black_score.style['left'] = '128px'
        #self.black_score.style['visibility'] = 'Courier New'
        self.white_score.style['font-family'] = 'Courier New'
        self.white_score.style['color'] = '#ff0066'
        self.white_score.style['font-style'] = 'italic'
        self.white_score.style['position'] = 'absolute'
        self.white_score.style['font-size'] = '22px'
        self.white_score.style['top'] = '13px'
        self.white_score.style['left'] = '225px'
        title_container.append(black_icon)
        title_container.append(black_title)
        title_container.append(self.black_score)
        title_container.append(self.white_score)
        title_container.append(white_title)
        title_container.append(white_icon)

        container = gui.Container(width=441, height=441)
        container.style['background-image'] = "url('/my_res:board.png')"
        for i in range(19):
            for j in range(19):
                self.piece = gui.Container(width=22, height=22)
                self.piece.style['background-image'] = "none"
                self.piece.style['background-repeat'] = 'no-repeat'
                self.piece.style['background-size'] = '22px 22px'
                self.piece.style['background-color'] = 'transparent'
                self.piece.style['position'] = 'absolute'
                self.piece.style['left'] = str(2 + 23 * j) + 'px'
                self.piece.style['top'] = str(52 + 23 * i) + 'px'
                self.images.append(self.piece)
                container.append(self.piece)
        container.onmousedown.do(self.on_place_piece)
        pass_button = gui.Button('Pass')
        pass_button.onclick.do(self.pass_turn)
        new_game_button = gui.Button('New Game')
        new_game_button.onclick.do(self.new_game)

        self.list_view = gui.ListView(selectable=False, width=100, height=441)
        self.list_view.style['border'] = "1px groove gray"
        self.list_view.style['margin-top'] = '50px'
        self.list_view.style['margin-left'] = '25px'

        screen.append(title_container)
        screen.append(container)
        screen.append(pass_button)
        screen.append(new_game_button)

        full.append([screen, self.list_view])

        return full
示例#13
0
    def main(self):
        verticalContainer = gui.Widget(640, 680, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        horizontalContainer = gui.Widget(620, 620,
                                         gui.Widget.LAYOUT_HORIZONTAL, 10)

        subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10)
        self.img = gui.Image(100, 100, './res/logo.png')

        self.table = gui.Table(300, 200)
        row = gui.TableRow()
        item = gui.TableTitle()
        item.append(str(id(item)), 'ID')
        row.append(str(id(item)), item)
        item = gui.TableTitle()
        item.append(str(id(item)), 'First Name')
        row.append(str(id(item)), item)
        item = gui.TableTitle()
        item.append(str(id(item)), 'Last Name')
        row.append(str(id(item)), item)
        self.table.append(str(id(row)), row)
        self.add_table_row(self.table, '101', 'Danny', 'Young')
        self.add_table_row(self.table, '102', 'Christine', 'Holand')
        self.add_table_row(self.table, '103', 'Lars', 'Gordon')
        self.add_table_row(self.table, '104', 'Roberto', 'Robitaille')
        self.add_table_row(self.table, '105', 'Maria', 'Papadopoulos')

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        self.lbl = gui.Label(200, 30, 'This is a LABEL!')

        self.bt = gui.Button(200, 30, 'Press me!')
        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self, 'on_button_pressed')

        self.txt = gui.TextInput(200, 30)
        self.txt.set_text('This is a TEXTAREA')
        self.txt.set_on_change_listener(self, 'on_text_area_change')

        self.spin = gui.SpinBox(200, 30, 100)
        self.spin.set_on_change_listener(self, 'on_spin_change')

        self.btInputDiag = gui.Button(200, 30, 'Open InputDialog')
        self.btInputDiag.set_on_click_listener(self, 'open_input_dialog')

        self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog')
        self.btFileDiag.set_on_click_listener(self,
                                              'open_fileselection_dialog')

        self.btUploadFile = gui.FileUploader(200, 30, './')
        self.btUploadFile.set_on_success_listener(self,
                                                  'fileupload_on_success')
        self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed')

        self.listView = gui.ListView(300, 120)
        self.listView.set_on_selection_listener(self, "list_view_on_selected")
        li0 = gui.ListItem(279, 20, 'Danny Young')
        li1 = gui.ListItem(279, 20, 'Christine Holand')
        li2 = gui.ListItem(279, 20, 'Lars Gordon')
        li3 = gui.ListItem(279, 20, 'Roberto Robitaille')
        self.listView.append('0', li0)
        self.listView.append('1', li1)
        self.listView.append('2', li2)
        self.listView.append('3', li3)

        self.dropDown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.dropDown.append('0', c0)
        self.dropDown.append('1', c1)
        self.dropDown.set_on_change_listener(self, 'drop_down_changed')
        self.dropDown.set_value('DropDownItem 0')

        self.slider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.slider.set_on_change_listener(self, 'slider_changed')

        self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00')
        self.colorPicker.set_on_change_listener(self, 'color_picker_changed')

        self.date = gui.Date(200, 20, '2015-04-13')
        self.date.set_on_change_listener(self, 'date_changed')

        # appending a widget to another, the first argument is a string key
        subContainerRight.append('1', self.lbl)
        subContainerRight.append('2', self.bt)
        subContainerRight.append('3', self.txt)
        subContainerRight.append('4', self.spin)
        subContainerRight.append('5', self.btInputDiag)
        subContainerRight.append('5_', self.btFileDiag)
        subContainerRight.append(
            '5__',
            gui.FileDownloader(200, 30, 'download test',
                               '../remi/res/logo.png'))
        subContainerRight.append('5___', self.btUploadFile)
        subContainerRight.append('6', self.dropDown)
        subContainerRight.append('7', self.slider)
        subContainerRight.append('8', self.colorPicker)
        subContainerRight.append('9', self.date)
        self.subContainerRight = subContainerRight

        subContainerLeft.append('0', self.img)
        subContainerLeft.append('1', self.table)
        subContainerLeft.append('2', self.listView)

        horizontalContainer.append('0', subContainerLeft)
        horizontalContainer.append('1', subContainerRight)

        menu = gui.Menu(620, 30)
        m1 = gui.MenuItem(100, 30, 'File')
        m2 = gui.MenuItem(100, 30, 'View')
        m2.set_on_click_listener(self, 'menu_view_clicked')
        m11 = gui.MenuItem(100, 30, 'Save')
        m12 = gui.MenuItem(100, 30, 'Open')
        m12.set_on_click_listener(self, 'menu_open_clicked')
        m111 = gui.MenuItem(100, 30, 'Save')
        m111.set_on_click_listener(self, 'menu_save_clicked')
        m112 = gui.MenuItem(100, 30, 'Save as')
        m112.set_on_click_listener(self, 'menu_saveas_clicked')

        menu.append('1', m1)
        menu.append('2', m2)
        m1.append('11', m11)
        m1.append('12', m12)
        m11.append('111', m111)
        m11.append('112', m112)

        verticalContainer.append('0', menu)
        verticalContainer.append('1', horizontalContainer)

        # returning the root widget
        return verticalContainer
    def initScheduler(self, robot):
        schedulerBox = self.sectionBox()

        controlBox = gui.HBox()
        schedulerBox.append(controlBox)
        manualModeBtn = gui.Button("Manual")
        manualModeBtn.set_on_click_listener(robot.c_manualMode)
        controlBox.append(manualModeBtn)
        autoModeBtn = gui.Button("Auto")
        autoModeBtn.set_on_click_listener(robot.c_autoMode)
        controlBox.append(autoModeBtn)

        self.controlModeGroup = sea.ToggleButtonGroup()
        self.controlModeGroup.addButton(manualModeBtn, "manual")
        self.controlModeGroup.addButton(autoModeBtn, "auto")

        hbox = gui.HBox()
        hbox.style['align-items'] = 'flex-start'
        schedulerBox.append(hbox)

        addActionBox = gui.VBox()
        hbox.append(addActionBox)

        addActionBox.append(gui.Label("Auto actions:"))

        self.genericActionList = gui.ListView()
        self.genericActionList.append("Drive to Point", "drive")
        self.genericActionList.append("Rotate in Place", "rotate")
        self.genericActionList.append("Rotate towards Point", "face")
        self.genericActionList.append("Shoot", "shoot")
        self.genericActionList.append("Toggle Intake", "intake")
        self.genericActionList.append("Set Starting Positon", "set")
        self.genericActionList.append("Set Robot Starting Angle", "angle")
        index = 0
        for action in robot.genericAutoActions:
            self.genericActionList.append(gui.ListItem(action.name),
                                          str(index))
            index += 1
        self.genericActionList.set_on_selection_listener(
            self.c_addGenericAction)
        addActionBox.append(self.genericActionList)

        hbox.append(gui.HBox(width=10))

        scheduleListBox = gui.VBox()
        hbox.append(scheduleListBox)
        clearScheduleBox = gui.HBox()
        clearScheduleBox.style['align-items'] = 'flex-end'
        scheduleListBox.append(clearScheduleBox)
        clearScheduleBox.append(gui.Label("Schedule:"))
        clearScheduleBtn = gui.Button("Clear")
        clearScheduleBtn.set_on_click_listener(self.c_clearSchedule)
        clearScheduleBox.append(clearScheduleBtn)

        self.schedulerList = gui.ListView()
        self.schedulerList.set_on_selection_listener(self.c_removeAction)
        scheduleListBox.append(self.schedulerList)

        schedulePresetLbl = gui.Label("Auto Sequence Presets")
        schedulerBox.append(schedulePresetLbl)
        presetIn = gui.Input(default_value="file name")
        schedulerBox.append(presetIn)
        schedulePresets = gui.HBox()
        schedulerBox.append(schedulePresets)
        self.presetDropdown = gui.DropDown()
        self.updatePresetFileDropdown()
        schedulerBox.append(self.presetDropdown)
        openPresetBtn = gui.Button("Open")
        schedulePresets.append(openPresetBtn)
        openPresetBtn.set_on_click_listener(self.c_openAutoPreset,
                                            self.presetDropdown)
        newPresetBtn = gui.Button("New")
        schedulePresets.append(newPresetBtn)
        newPresetBtn.set_on_click_listener(self.c_saveAutoPresetFromText,
                                           presetIn)
        schedulePresets.append(newPresetBtn)
        savePresetBtn = gui.Button("Save")
        schedulePresets.append(savePresetBtn)
        savePresetBtn.set_on_click_listener(self.c_saveAutoPresetFromDropdown,
                                            self.presetDropdown)
        schedulePresets.append(savePresetBtn)
        deletePresetBtn = gui.Button("Delete")
        schedulePresets.append(deletePresetBtn)
        deletePresetBtn.set_on_click_listener(self.c_deleteAutoPreset,
                                              self.presetDropdown)
        schedulePresets.append(deletePresetBtn)

        return schedulerBox
示例#15
0
    def main(self):
        verticalContainer = gui.Widget(640, 900, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        horizontalContainer = gui.Widget(620, 620,
                                         gui.Widget.LAYOUT_HORIZONTAL, 10)

        subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10)
        self.img = gui.Image(100, 100, '/res/logo.png')
        self.img.set_on_click_listener(self, 'on_img_clicked')

        self.table = gui.Table(300, 200)
        self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'],
                                   ['101', 'Danny', 'Young'],
                                   ['102', 'Christine', 'Holand'],
                                   ['103', 'Lars', 'Gordon'],
                                   ['104', 'Roberto', 'Robitaille'],
                                   ['105', 'Maria', 'Papadopoulos']])

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        self.count = 0
        self.counter = gui.Label(200, 30, '')

        self.lbl = gui.Label(200, 30, 'This is a LABEL!')

        self.bt = gui.Button(200, 30, 'Press me!')
        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self, 'on_button_pressed')

        self.txt = gui.TextInput(200, 30)
        self.txt.set_text('This is a TEXTAREA')
        self.txt.set_on_change_listener(self, 'on_text_area_change')

        self.spin = gui.SpinBox(200, 30, 100)
        self.spin.set_on_change_listener(self, 'on_spin_change')

        self.check = gui.CheckBoxLabel(200, 30, 'Label checkbox', True)
        self.check.set_on_change_listener(self, 'on_check_change')

        self.btInputDiag = gui.Button(200, 30, 'Open InputDialog')
        self.btInputDiag.set_on_click_listener(self, 'open_input_dialog')

        self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog')
        self.btFileDiag.set_on_click_listener(self,
                                              'open_fileselection_dialog')

        self.btUploadFile = gui.FileUploader(200, 30, './')
        self.btUploadFile.set_on_success_listener(self,
                                                  'fileupload_on_success')
        self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed')

        self.listView = gui.ListView(300, 120)
        self.listView.set_on_selection_listener(self, "list_view_on_selected")
        li0 = gui.ListItem(279, 20, 'Danny Young')
        li1 = gui.ListItem(279, 20, 'Christine Holand')
        li2 = gui.ListItem(279, 20, 'Lars Gordon')
        li3 = gui.ListItem(279, 20, 'Roberto Robitaille')
        self.listView.append('0', li0)
        self.listView.append('1', li1)
        self.listView.append('2', li2)
        self.listView.append('3', li3)

        self.link = gui.Link(200, 20, "http://localhost:8081",
                             "A link to here")

        self.dropDown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.dropDown.append('0', c0)
        self.dropDown.append('1', c1)
        self.dropDown.set_on_change_listener(self, 'drop_down_changed')
        self.dropDown.set_value('DropDownItem 0')

        self.slider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.slider.set_on_change_listener(self, 'slider_changed')

        self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00')
        self.colorPicker.set_on_change_listener(self, 'color_picker_changed')

        self.date = gui.Date(200, 20, '2015-04-13')
        self.date.set_on_change_listener(self, 'date_changed')

        self.video = gui.VideoPlayer(
            480, 270, 'http://www.w3schools.com/tags/movie.mp4',
            'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg'
        )

        # appending a widget to another, the first argument is a string key
        subContainerRight.append('0', self.counter)
        subContainerRight.append('1', self.lbl)
        subContainerRight.append('2', self.bt)
        subContainerRight.append('3', self.txt)
        subContainerRight.append('4', self.spin)
        subContainerRight.append('checkbox', self.check)
        subContainerRight.append('5', self.btInputDiag)
        subContainerRight.append('5_', self.btFileDiag)
        subContainerRight.append(
            '5__',
            gui.FileDownloader(200, 30, 'download test',
                               '../remi/res/logo.png'))
        subContainerRight.append('5___', self.btUploadFile)
        subContainerRight.append('6', self.dropDown)
        subContainerRight.append('7', self.slider)
        subContainerRight.append('8', self.colorPicker)
        subContainerRight.append('9', self.date)
        self.subContainerRight = subContainerRight

        subContainerLeft.append('0', self.img)
        subContainerLeft.append('1', self.table)
        subContainerLeft.append('2', self.listView)
        subContainerLeft.append('3', self.link)
        subContainerLeft.append('4', self.video)

        horizontalContainer.append('0', subContainerLeft)
        horizontalContainer.append('1', subContainerRight)

        menu = gui.Menu(620, 30)
        m1 = gui.MenuItem(100, 30, 'File')
        m2 = gui.MenuItem(100, 30, 'View')
        m2.set_on_click_listener(self, 'menu_view_clicked')
        m11 = gui.MenuItem(100, 30, 'Save')
        m12 = gui.MenuItem(100, 30, 'Open')
        m12.set_on_click_listener(self, 'menu_open_clicked')
        m111 = gui.MenuItem(100, 30, 'Save')
        m111.set_on_click_listener(self, 'menu_save_clicked')
        m112 = gui.MenuItem(100, 30, 'Save as')
        m112.set_on_click_listener(self, 'menu_saveas_clicked')
        m3 = gui.MenuItem(100, 30, 'Dialog')
        m3.set_on_click_listener(self, 'menu_dialog_clicked')

        menu.append('1', m1)
        menu.append('2', m2)
        menu.append('3', m3)
        m1.append('11', m11)
        m1.append('12', m12)
        m11.append('111', m111)
        m11.append('112', m112)

        menubar = gui.MenuBar(620, 30)
        menubar.append('1', menu)

        verticalContainer.append('0', menubar)
        verticalContainer.append('1', horizontalContainer)

        # kick of regular display of counter
        self.display_counter()

        # returning the root widget
        return verticalContainer
示例#16
0
    def main(self):
        with open("todo.json", "r") as todos:
            todo_list = json.load(todos)
            self.assistant = PersonalAssistant(todo_list)

        container = gui.VBox(
            width=500,
            height="auto",
            margin="0px auto",
            style={
                "display": "block",
                "min-height": "300px",
                "overflow": "hidden",
                "box-shadow": "none",
                "border": "1px solid #d7d7d7",
                "padding-bottom": "10px",
            },
        )

        menu = gui.Menu(
            width="100%",
            height="30px",
            style={
                "display": "relative",
                "background-color": "#58CCE0",
                "padding-top": "0",
            },
        )
        menubar = gui.MenuBar(
            width="100%",
            height="30px",
            style={
                "display": "relative",
                "margin-bottom": "16px",
                "padding-top": "0"
            },
        )
        menubar.append(menu)
        container.append(menubar)

        self.errors = gui.ListView()
        self.errors.attributes["class"] += " errors"

        container.append(self.errors)

        self.label = gui.Label("How can I help you?"
                               " 🤖",
                               width=340,
                               height=10)
        self.label.set_style({
            "font-size": "24px",
            "font-family": "'Montserrat', 'Arial', san-serif",
            "font-weight": "bold",
            "color": "#3b3b3b",
            "text-transform": "uppercase",
            "text-align": "center",
            "margin-bottom": "20px",
        })

        self.todoLabel = gui.Label("Manage to-dos", width=250, height=10)
        self.todoLabel.set_style(LABEL_STYLES)
        self.todoDropDown = gui.DropDown.new_from_list(
            ("Select an action", "Add a to-do", "Remove a to-do",
             "Get to-do list"),
            width=200,
            height=30,
            margin="15px",
        )
        self.todoDropDown.set_style({
            "font-size": "16px",
            "border": "none",
            "background-color": "#f5f5f5"
        })
        self.todoDropDown.select_by_value("")
        self.todoDropDown.onchange.connect(self.todo_drop_down_changed)

        self.birthdayLabel = gui.Label("Manage birthday dates list",
                                       width=250,
                                       height=15)
        self.birthdayLabel.set_style(LABEL_STYLES)
        self.birthdayDropDown = gui.DropDown.new_from_list(
            ("Select an action", "Add a birthday", "Remove a birthday",
             "Get birthday"),
            width=200,
            height=30,
            margin="10px",
        )
        self.birthdayDropDown.set_style({
            "font-size": "16px",
            "border": "none",
            "background-color": "#f5f5f5"
        })
        self.birthdayDropDown.select_by_value("")
        self.birthdayDropDown.onchange.connect(self.birthday_drop_down_changed)

        self.contactsLabel = gui.Label("Manage contacts list",
                                       width=250,
                                       height=15)
        self.contactsLabel.set_style(LABEL_STYLES)

        self.contactDropDown = gui.DropDown.new_from_list(
            ("Select an action", "Add a contact", "Remove a contact",
             "Get contact"),
            width=200,
            height=30,
            margin="10px",
        )
        self.contactDropDown.set_style({
            "font-size": "16px",
            "border": "none",
            "background-color": "#f5f5f5"
        })
        self.contactDropDown.select_by_value("")
        self.contactDropDown.onchange.connect(self.contact_drop_down_changed)

        container.append(self.label)
        container.append(self.todoLabel)
        container.append(self.todoDropDown)
        container.append(self.birthdayLabel)
        container.append(self.birthdayDropDown)
        container.append(self.contactsLabel)
        container.append(self.contactDropDown)

        # return of the root widget
        return container
示例#17
0
    def main(self):
        # get directory holding the code
        self.manager_dir=sys.path[0]
            
        if not os.path.exists(self.manager_dir + os.sep + 'pp_manager.py'):
            print >> sys.stderr, 'Pi Presents Manager - Bad Application Directory'
            exit()

        # object if there is no options file
        self.options_file_path=self.manager_dir+os.sep+'pp_config'+os.sep+'pp_web.cfg'
        if not os.path.exists(self.options_file_path):
            print >> sys.stderr, 'Pi Presents Manager - Cannot find web options file'
            exit()

        # read the options
        self.options_config=self.read_options(self.options_file_path)
        self.get_options(self.options_config)
        

        #create upload directory if necessary
        self.upload_dir_path=self.pp_home_dir+os.sep+'pp_temp'
        if not os.path.exists(self.upload_dir_path):
            os.makedirs(self.upload_dir_path)

        self.pp_profiles_dir=self.pp_home_dir+os.sep+'pp_profiles'+self.pp_profiles_offset
        if not os.path.exists(self.pp_profiles_dir):
            print >> sys.stderr, 'Profiles directory does not exist: ' + self.pp_profiles_dir
            exit()

        print >> sys.stderr, 'Web server started by pp_manager'

        #init variables
        self.profile_objects=[]
        self.current_profile=''

        # Initialise an instance of the Pi Presents and Web Editor driver classes
        self.pp=PiPresents()
        self.ed = WebEditor()
        self.ed.init(self.manager_dir)


        # root and frames
        root = gui.VBox(width=450,height=600) #10
        top_frame=gui.VBox(width=450,height=40) #1
        middle_frame=gui.VBox(width=450,height=500) #5
        button_frame=gui.HBox(width=250,height=40) #10

        # menu
        menu = gui.Menu(width=430, height=30)
        
        # media menu
        media_menu = gui.MenuItem('Media',width=100, height=30)        
        media_copy_menu = gui.MenuItem('Copy',width=100, height=30)
        media_upload_menu = gui.MenuItem('Upload',width=100, height=30)
        media_copy_menu.set_on_click_listener(self, 'on_media_copy_clicked')
        media_upload_menu.set_on_click_listener(self, 'on_media_upload_clicked')
        
        #profile menu
        profile_menu = gui.MenuItem( 'Profile',width=100, height=30)        
        profile_copy_menu = gui.MenuItem('Copy',width=100, height=30)
        profile_copy_menu.set_on_click_listener(self, 'on_profile_copy_clicked')
        profile_upload_menu = gui.MenuItem('Upload',width=100, height=30)
        profile_upload_menu.set_on_click_listener(self, 'on_profile_upload_clicked')
        profile_download_menu = gui.MenuItem('Download',width=100, height=30)
        profile_download_menu.set_on_click_listener(self, 'on_profile_download_clicked')

        # editor menu
        editor_menu=gui.MenuItem('Editor',width=100,height=30)
        editor_run_menu=gui.MenuItem('Run',width=100,height=30)
        editor_run_menu.set_on_click_listener(self,'on_editor_run_menu_clicked')
        editor_exit_menu=gui.MenuItem('Exit',width=100,height=30)
        editor_exit_menu.set_on_click_listener(self,'on_editor_exit_menu_clicked')  


        #options menu
        options_menu=gui.MenuItem('Options',width=100,height=30)
        options_manager_menu=gui.MenuItem('Manager',width=100,height=30)
        options_manager_menu.set_on_click_listener(self,'on_options_manager_menu_clicked')
        options_autostart_menu=gui.MenuItem('Autostart',width=100,height=30)
        options_autostart_menu.set_on_click_listener(self,'on_options_autostart_menu_clicked')        

        
        # list of profiles
        self.profile_list = gui.ListView(width=300, height=300)
        self.profile_list.set_on_selection_listener(self,'on_profile_selected')

         
        #status and buttons

        self.profile_name = gui.Label('Selected Profile: ',width=400, height=20)
        
        self.pp_state_display = gui.Label('',width=400, height=20)
        
        self.run_pp = gui.Button('Run',width=80, height=30)
        self.run_pp.set_on_click_listener(self, 'on_run_button_pressed')
        
        self.exit_pp = gui.Button('Exit',width=80, height=30)
        self.exit_pp.set_on_click_listener(self, 'on_exit_button_pressed')

        self.refresh = gui.Button('Refresh List',width=120, height=30)
        self.refresh.set_on_click_listener(self, 'on_refresh_pressed')
        
        self.status = gui.Label('Manager for Pi Presents Started',width=400, height=30)

        # Build the layout

        # buttons
        button_frame.append(self.run_pp)
        button_frame.append(self.exit_pp)
        button_frame.append(self.refresh)
        
        # middle frame
        middle_frame.append(self.pp_state_display)
        middle_frame.append(button_frame)
        middle_frame.append(self.profile_list)
        middle_frame.append(self.profile_name)
        middle_frame.append(self.status)

        # menus
        profile_menu.append(profile_copy_menu)
        profile_menu.append(profile_upload_menu)
        profile_menu.append(profile_download_menu)
        
        media_menu.append(media_copy_menu)
        media_menu.append(media_upload_menu)

        editor_menu.append(editor_run_menu)
        editor_menu.append(editor_exit_menu)
        
        options_menu.append(options_manager_menu)
        options_menu.append(options_autostart_menu)

        menu.append(profile_menu)
        menu.append(media_menu)
        menu.append(editor_menu)
        menu.append(options_menu)
        
        top_frame.append(menu)
        
        root.append(top_frame)
        root.append(middle_frame)
        

        # display the initial list of profiles
        self.display_profiles()

        # kick of regular display of Pi Presents running state
        self.display_state()

        # returning the root widget
        return root
    def main(self):
        # print 'DOING MAIN executed once when server starts'
        # ***************************************
        # INIT
        # ***************************************
        self.editor_issue="1.3"

        # get directory holding the code
        self.editor_dir=sys.path[0]

        ColourMap().init()
        
        # initialise editor options OSC config class, and OSC editors
        self.eo=Options()
        self.eo.init_options(self.editor_dir)
        self.osc_config=OSCConfig()
        self.osc_ute= OSCUnitType()

        
        # initialise variables
        self.init() 

        # BUILD THE GUI
        # frames
        root = gui.Widget(width=900,height=500) #1
        root.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL)         
        top_frame=gui.Widget(width=900,height=40)#1
        top_frame.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        bottom_frame=gui.Widget(width=900,height=300)#1
        bottom_frame.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)       
        root.append(top_frame)
        root.append(bottom_frame)

        left_frame=gui.Widget(width=350,height=400)#1
        left_frame.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL)
        left_frame.style['margin']='10px'
        middle_frame=gui.VBox(width=50,height=300)#1
        middle_frame.style['margin']='10px'
        # middle_frame.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL)   
        right_frame=gui.Widget(width=350,height=400)#1
        right_frame.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL)   
        updown_frame=gui.VBox(width=50,height=300)#1
        updown_frame.style['margin']='10px'
        # updown_frame.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL)   

        bottom_frame.append(left_frame)
        bottom_frame.append(middle_frame)
        bottom_frame.append(right_frame)
        bottom_frame.append(updown_frame)

        #menu
        menu = gui.Menu(width=700, height=30)
        top_frame.append(menu)

        #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_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_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)
        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')
        profile_new_menu.append(pmenu)
        
        # shows menu              
        show_menu = gui.MenuItem( 'Show',width=80, height=30)
        show_delete_menu = gui.MenuItem('Delete',width=120, height=30)
        show_delete_menu.set_on_click_listener(self, 'remove_show')    
        show_edit_menu = gui.MenuItem('Edit',width=120, height=30)
        show_edit_menu.set_on_click_listener(self, 'm_edit_show')
        show_copy_to_menu = gui.MenuItem( 'Copy To',width=120, height=30)
        show_copy_to_menu.set_on_click_listener(self, 'copy_show')
        show_add_menu = gui.MenuItem( 'Add',width=120, height=30)
        show_menu.append(show_delete_menu)
        show_menu.append(show_edit_menu)
        show_menu.append(show_copy_to_menu)
        show_menu.append(show_add_menu)


        pmenu = gui.MenuItem('Menu',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_menushow')
        show_add_menu.append(pmenu)
        
        pmenu = gui.MenuItem( 'Media Show',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_mediashow')
        show_add_menu.append(pmenu)
        
        pmenu = gui.MenuItem('Live Show',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_liveshow')
        show_add_menu.append(pmenu)

        pmenu = gui.MenuItem('Hyperlink Show',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_hyperlinkshow')
        show_add_menu.append(pmenu)

        pmenu = gui.MenuItem('RadioButton Show',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_radiobuttonshow')
        show_add_menu.append(pmenu)

        pmenu = gui.MenuItem( 'Art Mediashow Show',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_artmediashow')
        show_add_menu.append(pmenu)

        pmenu = gui.MenuItem( 'Art Liveshow Show',width=150, height=30)
        pmenu.set_on_click_listener(self, 'add_artliveshow')
        show_add_menu.append(pmenu)

        # medialists menu
        medialist_menu = gui.MenuItem( 'Medialist',width=80, height=30)
        
        medialist_delete_menu = gui.MenuItem( 'Delete',width=120, height=30)
        medialist_delete_menu.set_on_click_listener(self, 'remove_medialist')

        
        medialist_add_menu = gui.MenuItem( 'Add',width=120, height=30)
        medialist_add_menu.set_on_click_listener(self, 'add_medialist')
        
        medialist_copy_to_menu = gui.MenuItem('Copy To',width=120, height=30)
        medialist_copy_to_menu.set_on_click_listener(self, 'copy_medialist')
        
        medialist_menu.append(medialist_add_menu)
        medialist_menu.append(medialist_delete_menu)
        medialist_menu.append(medialist_copy_to_menu)

        # tracks menu
        track_menu = gui.MenuItem('Track',width=80, height=30)

        track_delete_menu = gui.MenuItem('Delete',width=120, height=30)
        track_delete_menu.set_on_click_listener(self, 'remove_track')
        track_edit_menu = gui.MenuItem( 'Edit',width=120, height=30)
        track_edit_menu.set_on_click_listener(self, 'm_edit_track')
        track_add_from_dir_menu = gui.MenuItem('Add Directory',width=120, height=30)
        track_add_from_dir_menu.set_on_click_listener(self, 'add_tracks_from_dir')
        track_add_from_file_menu = gui.MenuItem('Add File',width=120, height=30)
        track_add_from_file_menu.set_on_click_listener(self, 'add_track_from_file')
        track_new_menu = gui.MenuItem('New',width=120, height=30)

        track_new_video_menu = gui.MenuItem('Video',width=120, height=30)
        track_new_video_menu.set_on_click_listener(self, 'new_video_track')
        track_new_audio_menu = gui.MenuItem('Audio',width=120,height=30)
        track_new_audio_menu.set_on_click_listener(self, 'new_audio_track')
        track_new_image_menu = gui.MenuItem( 'Image',width=120, height=30)
        track_new_image_menu.set_on_click_listener(self, 'new_image_track')
        track_new_web_menu = gui.MenuItem( 'Web',width=120, height=30)
        track_new_web_menu.set_on_click_listener(self, 'new_web_track')
        track_new_message_menu = gui.MenuItem('Message',width=120, height=30)
        track_new_message_menu.set_on_click_listener(self, 'new_message_track')
        track_new_show_menu = gui.MenuItem('Show',width=120, height=30)
        track_new_show_menu.set_on_click_listener(self, 'new_show_track')
        track_new_menu_menu = gui.MenuItem('Menu',width=120, height=30)
        track_new_menu_menu.set_on_click_listener(self, 'new_menu_track')

        track_new_menu.append(track_new_video_menu)
        track_new_menu.append(track_new_audio_menu)
        track_new_menu.append(track_new_image_menu)
        track_new_menu.append(track_new_web_menu)        
        track_new_menu.append(track_new_message_menu)
        track_new_menu.append(track_new_show_menu)
        track_new_menu.append(track_new_menu_menu)
        
        track_menu.append(track_delete_menu)
        track_menu.append(track_edit_menu)
        track_menu.append(track_add_from_dir_menu)
        track_menu.append(track_add_from_file_menu)
        track_menu.append(track_new_menu)


      
        options_menu = gui.MenuItem('Options',width=80, height=30)
        options_edit_menu=gui.MenuItem('Edit',width=80, height=30)
        options_edit_menu.set_on_click_listener(self, 'edit_options')
        options_menu.append(options_edit_menu)

        # osc menu
        osc_menu = gui.MenuItem( 'OSC',width=80, height=30)  
        osc_create_menu = gui.MenuItem( 'Create',width=120, height=30)
        osc_create_menu.set_on_click_listener(self, 'create_osc')
        osc_edit_menu = gui.MenuItem( 'Edit',width=120, height=30)
        osc_edit_menu.set_on_click_listener(self, 'edit_osc')
        osc_delete_menu = gui.MenuItem( 'Delete',width=120, height=30)
        osc_delete_menu.set_on_click_listener(self, 'delete_osc')
        osc_menu.append(osc_create_menu)
        osc_menu.append(osc_edit_menu)
        osc_menu.append(osc_delete_menu)
        
        # help menu
        help_menu = gui.MenuItem( 'Help',width=80, height=30)
        help_text_menu = gui.MenuItem( 'Help',width=80, height=30)
        help_text_menu.set_on_click_listener(self, 'show_help')
        about_menu = gui.MenuItem( 'About',width=80, height=30)
        about_menu.set_on_click_listener(self, 'show_about')
        help_menu.append(help_text_menu)
        help_menu.append(about_menu)

        menu.append(profile_menu)
        menu.append(show_menu)
        menu.append(medialist_menu)
        menu.append(track_menu)
        menu.append(osc_menu)
        menu.append(options_menu)
        menu.append(help_menu)


        
        #shows and medialists
        shows_label=gui.Label('<b>Shows</b>',width=300, height=20)
        shows_label.style['margin']='5px'
        self.shows_display= gui.ListView(width=350, height=150)
        self.shows_display.set_on_selection_listener(self,'show_selected')
        
        medialists_label=gui.Label('<b>Medialists</b>',width=300, height=20)
        medialists_label.style['margin']='5px'
        self.medialists_display= gui.ListView(width=350, height=150)
        self.medialists_display.set_on_selection_listener(self,'medialist_selected')

        left_frame.append(shows_label)
        left_frame.append(self.shows_display)         
        left_frame.append(medialists_label)
        left_frame.append(self.medialists_display)

        #edit show button
        edit_show = gui.Button('Edit\nShow',width=50, height=50)
        edit_show.set_on_click_listener(self, 'm_edit_show')
        middle_frame.append(edit_show)

        #tracks
        tracks_label=gui.Label('<b>Tracks in Selected Medialist</b>',width=300, height=20)
        tracks_label.style['margin']='5px'
        self.tracks_display= gui.ListView(width=350, height=300)
        self.tracks_display.set_on_selection_listener(self,'track_selected')

        right_frame.append(tracks_label)
        right_frame.append(self.tracks_display)  

        #tracks buttons
        add_track = gui.Button('Add',width=50, height=50)
        add_track.set_on_click_listener(self, 'add_track_from_file')
        updown_frame.append(add_track)
        
        edit_track = gui.Button('Edit',width=50, height=50)
        edit_track.set_on_click_listener(self, 'm_edit_track')
        updown_frame.append(edit_track)        

        up_track = gui.Button('Up',width=50, height=50)
        up_track.set_on_click_listener(self, 'move_track_up')
        updown_frame.append(up_track)

        down_track = gui.Button('Down',width=50, height=50)
        down_track.set_on_click_listener(self, 'move_track_down')
        updown_frame.append(down_track)
        return root
示例#19
0
 def test_init(self):
     widget = gui.ListView()
     assertValidHTML(widget.repr())
示例#20
0
    def __init__(self, *args):
        super(HistoryWidget, self).__init__(*args)
        self.css_width = "100%"
        self.container = gui.Container()
        self.container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)
        self.events_hist_list = gui.ListView()
        self.unique_labels_list = gui.ListView()
        self.unique_rois_list = gui.ListView()

        self.container.append(self.events_hist_list)

        btn_class = "btn btn-primary"
        btn_css = css.HISTORY_SEARCH_STYLE

        self.search_history_btn = SButton("Search", "fa-search", btn_class)
        self.set_today_btn = SButton("Today", "fa-sun", btn_class, btn_css)
        self.set_prev_day_btn = SButton("", "fa-chevron-left", btn_class, btn_css)
        self.set_next_day_btn = SButton("", "fa-chevron-right", btn_class, btn_css)

        todays_date = datetime.now().strftime(DAY_FORMAT)
        self.search_from_date_widget = gui.Date(todays_date)
        self.search_to_date_widget = gui.Date(todays_date)
        self.filter_by_label_input = gui.TextInput()
        self.filter_by_label_input.set_text("*")
        self.search_info_lbl = gui.Label("")
        self.download_selected_btn = SButton(
            "Download selected", "fa-download", btn_class
        )
        self.select_all_btn = SButton("Select All", "fa-check-square", btn_class)
        self.deselect_all_btn = SButton("Deselect All", "fa-square", btn_class)
        self.reset_filters_btn = SButton("Reset", "fa-undo-alt", btn_class)
        self.apply_filters_btn = SButton("Filter", "fa-filter", btn_class)
        self.show_only_unique_events_btn = ToggleButton("Enable/Disable", style=btn_css)
        self.show_only_unique_events_btn.css_width = "100%"

        search_form = CustomFormWidget()
        search_form.css_width = "70%"
        search_form.add_field("from_day", "Search from", self.search_from_date_widget)
        search_form.add_field("to_day", "Search to", self.search_to_date_widget)
        search_form.add_field("by_label", "Filter by label", self.filter_by_label_input)
        search_form.add_field("only_unique", "Show only unique events", self.show_only_unique_events_btn)

        hbox = gui.HBox()
        hbox.css_display = "block"
        hbox.append(self.set_prev_day_btn)
        hbox.append(self.set_today_btn)
        hbox.append(self.set_next_day_btn)
        hbox.append(self.search_history_btn)

        search_form.add_field("controls", "", hbox)
        search_form.append(self.search_info_lbl)

        form_layout = gui.VBox()
        form_layout.append(search_form)

        controls_layout = gui.HBox()
        controls_layout.css_display = "block"
        controls_layout.append(self.download_selected_btn)
        controls_layout.append(self.select_all_btn)
        controls_layout.append(self.deselect_all_btn)
        controls_layout.append(self.apply_filters_btn)
        controls_layout.append(self.reset_filters_btn)

        self.hourly_hist_widget = HourlyToggleHistogram()
        self.style["padding"] = "0px 5px"
        self.append(HorizontalLine())
        self.append(form_layout)
        self.append(HorizontalLine())
        self.append(self.hourly_hist_widget)
        self.append(self.unique_rois_list)
        self.append(self.unique_labels_list)
        self.append(HorizontalLine())
        self.append(controls_layout)
        self.append(self.container)
        self.append(HorizontalLine())

        # signals:
        self.search_history_btn.onclick.do(self.update_events_history_list_thread)
        self.set_prev_day_btn.onclick.do(self.shift_search_dates, delta=-1)
        self.set_next_day_btn.onclick.do(self.shift_search_dates, delta=1)
        self.set_today_btn.onclick.do(self.set_today_date)
        self.download_selected_btn.onclick.do(self.on_download_images)
        self.select_all_btn.onclick.do(self.select_all_images)
        self.deselect_all_btn.onclick.do(self.deselect_all_images)
        self.reset_filters_btn.onclick.do(self.reset_filters)
        self.apply_filters_btn.onclick.do(self.apply_filters)