Esempio n. 1
0
    def __init__(self, project=None):
        BaseWidget.__init__(self, 'Task')
        self.layout().setContentsMargins(5, 10, 5, 5)

        self.precmdwin = None
        self.postcmdwin = None

        self._namefield = ControlText('Task name', changed_event=self.__name_edited_evt)
        self._use_server = ControlCheckBox('Trigger soft codes using a UDP port')
        self._precmds = ControlList(
            'Pre commands',
            add_function=self.__add_pre_command,
            remove_function=self.__remove_pre_command,
            readonly=True
        )
        self._postcmds = ControlList(
            'Post commands',
            add_function=self.__add_post_command,
            remove_function=self.__remove_post_command,
            readonly=True
        )

        self._formset = [
            '_namefield',
            '_use_server',
            '_precmds',
            '_postcmds',
            ' '
        ]

        Task.__init__(self, project)

        self.update_commands()
Esempio n. 2
0
    def __init__(self, timeline=None):
        super(Graph2Event, self).__init__('Graph to event',
                                          parent_win=timeline)
        self.setContentsMargins(10, 10, 10, 10)
        self._timeline = timeline

        # Definition of the forms fields
        self._graphs_list = ControlList('Graphs list (try double click)')
        self._equation = ControlTextArea('Equation')
        self._eventname = ControlText('Event name', 'New event')
        self._rownumber = ControlNumber('Row number', 0, 0, 1000)
        self._mindiff = ControlNumber('Minimum of frames', 0, 0, 1000000)
        self._genevts_btn = ControlButton('Generate events')

        self._formset = [
            (['_graphs_list'], '||', [
                ('_eventname', '_rownumber', '_mindiff'),
                '_equation',
                '_genevts_btn',
            ]),
        ]

        self._graphs_list.cell_double_clicked_event = self.__cell_double_clicked_evt
        self._graphs_list.readonly = True
        self._graphs_list.select_entire_row = True
        self._genevts_btn.value = self.__generage_events_evt
Esempio n. 3
0
    def __init__(self, setup=None):
        BaseWidget.__init__(self, 'Session')
        self.layout().setContentsMargins(5, 10, 5, 5)

        self._name = ControlText('Session')
        self._setup_name = ControlText('Setup')
        self._board_name = ControlText('Board')
        self._task_name = ControlText('Task')
        self._started = ControlText('Started on')
        self._ended = ControlText('Ended on')
        self._subjects = ControlList('Subjects')
        self._board_serial_port = ControlText('Serial port')
        self._variables = ControlList('Variables')

        Session.__init__(self, setup)

        self._formset = [
            '_name',
            '_started',
            '_ended',
            '_setup_name',
            '_task_name',
            '_board_name',
            '_board_serial_port',
            '_subjects',
            '_variables',
        ]

        self._subjects.readonly = True
        self._subjects.enabled = False
        self._variables.readonly = True
        self._variables.enabled = False
        self._setup_name.enabled = self._board_name.enabled = self._task_name.enabled = False
        self._board_serial_port.enabled = self._started.enabled = self._ended.enabled = False
        self._name.changed_event = self.__name_edited_evt
Esempio n. 4
0
    def __init__(self, parent=None, video=None):
        BaseWidget.__init__(self, 'Simple workflow editor', parent_win=parent)
        self._parent = parent

        self._player = ControlPlayer('Player')
        self._imgfilters = ControlList('Image filters')
        self._imageflows = ControlCombo('Image workflows')
        self._blobsflows = ControlCombo('Blobs workflows')
        self._blobsfilters = ControlList('Blobs filters')

        self.formset = [
            '_player', '=',
            [{
                'a:Image filter': ['_imageflows', '_imgfilters'],
                'b:Blobs filter': ['_blobsflows', '_blobsfilters']
            }]
        ]

        self.load_order = [
            '_imageflows', '_blobsflows', '_imgfilters', '_blobsfilters'
        ]

        self._imgfilters.select_entire_row = True
        self._blobsfilters.select_entire_row = True
        self._imageflows.changed_event = self.__imageflows_changed_event
        self._blobsflows.changed_event = self.__blobsflows_changed_event
        self._player.process_frame_event = self.__process_frame

        self.video_capture = video

        self._pipelines = {}  # dictinary with all the available pipelines
        self._pipeline = None  # active pipeline class
Esempio n. 5
0
    def __init__(self, timeline=None):
        super(GraphsEventsGenerator,
              self).__init__('Apply a function to the graph values',
                             parent_win=timeline)
        self.setContentsMargins(10, 10, 10, 10)
        self._timeline = timeline

        # Definition of the forms fields
        self._graphs_list = ControlList('Graphs list (try double click)',
                                        readonly=False,
                                        select_entire_row=True)
        self._equation = ControlTextArea('Equation')
        self._graphname = ControlText('Graph name')
        self._genevts_btn = ControlButton('Generate graph')

        self._formset = [
            (['_graphs_list'], '||', [
                '_graphname',
                '_equation',
                '_genevts_btn',
            ]),
        ]

        self._graphs_list.cell_double_clicked_event = self.__cell_double_clicked_evt
        self._graphs_list.readonly = True
        self._graphs_list.select_entire_row = True
        self._genevts_btn.value = self.__generage_events_evt
Esempio n. 6
0
    def __init__(self):
        BaseWidget.__init__(self, 'Email List')
        self._list_of_emails = list()
        self._emailList = ControlList(
            'Emails', item_selection_changed_event=self.__get_body)
        self._emailList.horizontal_headers = ['Sender', 'Date', 'Subject']
        self._emailList.readonly = True
        self._emailList.select_entire_row = True
        self._email = '*****@*****.**'
        self._pass = '******'
        self._panel = EmailWindow()
        self._panel.parent = self

        # Get a connection to your email account
        try:
            include_seen = True
            self._myCon = MyCon(self._email, self._pass)
            self._myCon._con.select('inbox')
            self._email_ids = self._myCon.get_email_ids(include_seen)
            self._email_index = 0  # initialize index to first element
        except ValueError as e:
            print(e)

        index = 0
        for email in self._email_ids:
            sender, date, subject, body = self._myCon.extract_info(email)
            mail = Email(index, sender, date, subject, body)
            self._list_of_emails.append(mail)
            self._emailList.__add__(
                [mail.get_sender(),
                 mail.get_date(),
                 mail.get_subject()])
        self._emailList.resize_rows_contents()
Esempio n. 7
0
    def __init__(self):
        # Class Vars:
        self.__players = []  # List of players

        # Player Setup Tab -- Init UI Elements
        #super(MBUI, self).__init__("Millennium Blades Helper")
        BaseWidget.__init__(self, "Millennium Blades Helper")
        self._lstPlayers = ControlList('Player List')
        self._btnAddPl = ControlButton('Add Player')
        self._btnRemPl = ControlButton('Remove Selected Player')
        self._btnGenPl = ControlButton('Generate Player Setup')

        # Player Setup Tab -- Set up properties of UI elements, attach callbacks, etc.
        self._lstPlayers.horizontal_headers = [
            'Name', 'Character', 'Starter Deck'
        ]
        self._btnAddPl.value = self.__onAddPlayerClick
        self._btnRemPl.value = self.__onRemoveSelectedPlayerClick
        self._btnGenPl.value = self.__onGeneratePlayerSetupClick

        # Store Setup Tab -- Init UI Elements
        self._lstStore = ControlList('Store Components')
        self._ckAreaLabel = ControlLabel('Sets To Use')
        self._btnGenerateSt = ControlButton('Generate Store')

        # Store Setup Tab -- Set up properties of UI elements, attach callbacks etc.
        self._lstStore.horizontal_headers = ['Category', 'Sets']
        self._btnGenerateSt.value = self.__onGenerateStoreClick

        # Scoring Tab -- Init UI Components
        self._scoringPanel = ControlEmptyWidget()
        self._btnGetScoring = ControlButton('Generate Score Sheet')

        # Scoring Tab -- Set up properties of UI elements, attach callbacks etc.
        self._btnGetScoring.value = self.__onGenerateScoringClick

        # Set Selection Tab -- Init UI Components
        self._chkArea = ControlCheckBoxList('Sets To Use')

        # Set Selection Tab -- Set up properties of UI elements, attach callbacks etc.
        self._chkArea += ('Base Set', True)
        self._chkArea += ('Set Rotation', True)
        self._chkArea += ('MX #1: Crossover', True)
        self._chkArea += ('MX #2: Sponsors', True)
        self._chkArea += ('MX #3: Fusion Chaos', True)
        self._chkArea += ('MX #4: Final Bosses', True)
        self._chkArea += ('MX #5: Futures', True)
        self._chkArea += ('MX #6: Professionals', True)

        # Set up tabs and component flow for UI
        self.formset = [{
            '1. Player Setup':
            ['_lstPlayers', ' ', ('_btnAddPl', '_btnRemPl', '_btnGenPl')],
            '2. Store Setup': ['_lstStore', ' ', '_btnGenerateSt'],
            '3. Scoring': ['_scoringPanel', '_btnGetScoring'],
            '4. Set Selection': ['_chkArea']
        }]
Esempio n. 8
0
    def __init__(self, *args, **kwargs):
        super().__init__('Cinema manager')

        self._pesel = ""
        self._client = Client('http://localhost:8080/projekt?wsdl')
        self._selected_date = date.today()

        # Screening window
        self._search_screenings_button = ControlButton("Search")
        self._screening_day = ControlNumber("Day:", default=self._selected_date.day, minimum=1,
                                            maximum=monthrange(self._selected_date.year, self._selected_date.month)[1],
                                            changed_event=self._change_day)
        self._screening_month = ControlNumber("Month:", default=self._selected_date.month, minimum=1,
                                              maximum=12, changed_event=self._change_month)
        self._screening_year = ControlNumber("Year:", default=self._selected_date.year,
                                             minimum=self._selected_date.year,
                                             maximum=self._selected_date.year + 1,
                                             changed_event=self._change_day)
        self._screening_list = ControlList('Screenings', readonly=True, select_entire_row=True,
                                           cell_double_clicked_event=self._screening_changed_event)
        self._screening_list.horizontal_headers = ['Time', 'Movie', 'Description']
        self._all_showings = self._client.service.getShowingsByDate(self._selected_date.year, self._selected_date.month,
                                                                    self._selected_date.day)
        self._search_screenings_button.value = self._searchScreeningsButton

        for showing in self._all_showings:
            self._screening_list += [showing.date.strftime("%H:%M"), str(showing.movie.title),
                                     str(showing.movie.description)]

        # Client window
        self._all_reservations = []

        self._reservation_list = ControlList('Reservations', readonly=True, select_entire_row=True,
                                             cell_double_clicked_event=self._reservation_changed_event)
        self._reservation_list.horizontal_headers = ['Date', 'Time', 'Movie', 'Seats', 'Paid']
        self._screening_panel = ControlDockWidget()
        self._screening_panel.hide()
        self._reservation_panel = ControlDockWidget()
        self._reservation_panel.hide()
        self._loginWindow = LoginWindow(self._client)
        self.hide()
        self._loginWindow.parent = self
        self._loginWindow.show()
        print(self._client.service)
        # Define the organization of the Form Controls
        self.formset = [{
            'a:Screening': [('_screening_day', '_screening_month', '_screening_year', '_search_screenings_button'), '=',
                            '_screening_list'],
            'b:Client': ['_reservation_list']
        },
        ]
Esempio n. 9
0
    def __init__(self, project=None):
        """

        :param project: project where this board belongs
        :type project: pycontrolgui.models.project.Project
        """
        BaseWidget.__init__(self, 'Board')
        self.layout().setContentsMargins(5, 10, 5, 5)

        self._name = ControlText('Box name')
        self._serial_port = ControlCombo('Serial port')
        self._refresh_serials = ControlButton(
            '',
            icon=QtGui.QIcon(conf.REFRESH_SMALL_ICON),
            default=self.__refresh_serials_pressed,
            helptext="Press here to refresh the list of available devices.")
        self._log_btn = ControlButton('Console')
        self._active_bnc = ControlCheckBoxList('BNC')
        self._active_wired = ControlCheckBoxList('Wired')
        self._active_behavior = ControlCheckBoxList('Behavior')
        self._loadports_btn = ControlButton('Load board info')
        self._netport = ControlNumber('Net port',
                                      default=36000 + len(project.boards),
                                      minimum=36000,
                                      maximum=36100)
        self._events = ControlList('Events', readonly=True)
        self._inputchannels = ControlList('Input channels', readonly=True)
        self._outputchannels = ControlList('Output channels', readonly=True)

        self._saved_serial_port = None

        Board.__init__(self, project)

        self._formset = [
            '_name', ('_serial_port', '_refresh_serials'), '_netport',
            '_log_btn', '=', '_loadports_btn', {
                'Ports': [
                    'Enabled or disable ports',
                    '_active_bnc',
                    '_active_wired',
                    '_active_behavior',
                ],
                'Events': ['_events'],
                'Input ch.': ['_inputchannels'],
                'Output ch.': ['_outputchannels']
            }
        ]
        self._name.changed_event = self.__name_changed_evt
        self._loadports_btn.value = self.__load_bpod_ports

        self._fill_serial_ports()
Esempio n. 10
0
    def __init__(self):
        super(MainWindow, self).__init__('PABLOPOLY')
        print()
        # Setting defaults settings
        self._board = ControlList(label='Tabuleiro')
        self._playDice = ControlButton('Jogar Dado')
        self.mylabel = ControlLabel('One')
        self._teste = ControlWeb()
        self._teste.value = 'https://github.com/UmSenhorQualquer/pyforms'
        self._myMoney = ControlProgress(label='Your Money is on %p%',
                                        default=15,
                                        min=0,
                                        max=100)
        self._informations = ControlLabel(
            'Inital Money: $ 1500,00 | Max Money: $ 10000,00')

        self._board.value = returnBoad()

        self.formset = [
            (('_teste', '=', '_myMoney'), '_playDice'),
            '_informations',
        ]
        print(self.formset)

        self._playDice.value = self.__playDices
 def __init__(self, user=None, connection=None):
     BaseWidget.__init__(self)
     self._admin = user
     self._connection = connection
     self._add_user_button = ControlButton('New User')
     self._refresh_button = ControlButton('Refresh List')
     self._add_user_button.value= self.__add_User_btnAction
     self._refresh_button.value= self.__refresh
     self._userList = ControlList('Users',select_entire_row=True)
     self._userList.readonly=True
     self._userList.cell_double_clicked_event = self.__onSelect
     self._userList.horizontal_headers=['Admin', 'Name', 'Email']
     self._userList.add_popup_menu_option('Toggle Admin Status', function_action=self.__admin_power)
     self._userList.add_popup_menu_option('Edit', function_action=self.__popEdit)
     if self._admin!=None and self._connection!=None:
         self.__retreive_users()
Esempio n. 12
0
    def __init__(self):
        BaseWidget.__init__(self)
        Organisms.__init__(self)

        self._list = ControlList(
            'Organisms',
            add_function=self.__addOrganismBtnAction,
            remove_function=self.__removeOrganismBtnAction)
        self._list.horizontal_headers = [
            'Kingdom', 'Class', 'Order', 'Family', 'Name'
        ]
        self._panel = ControlEmptyWidget()
        self.filedialog = ControlFile()
        self.filedialog.hide()

        self.mainmenu = [{
            'File': [{
                'Open': self.__openMenuAction
            }, {
                'Save': self.__saveMenuAction
            }]
        }]

        # Add by default some entities
        self.add(cat)
        self.add(human)
Esempio n. 13
0
    def __init__(self, columns, parent=None):
        super(GenericCsvParserDialog, self).__init__('CSV Choose the columns',
                                                     parent_win=parent)

        self._filename = None
        self._columns = columns
        self._columns_indexes = []
        self._rownum = 0

        # Definition of the forms fields
        self._filename = ControlFile('CSV File')
        self._separator = ControlText('Separator', default='auto')
        self._startingrow = ControlNumber('Starting row', default=0)

        for index, column in enumerate(columns):
            setattr(
                self, '_col_{0}'.format(index),
                ControlNumber(column, default=index, minimum=-1, maximum=1000))

        self._filePreview = ControlList('Preview')
        self._loadButton = ControlButton('Load')

        form_row = ['_separator'] + [
            '_col_{0}'.format(index) for index, column in enumerate(columns)
        ] + ['_loadButton']

        self._formset = [('_filename', '_startingrow'),
                         tuple(form_row), '_filePreview']
        self._separator.changed_event = self.__refreshPreview
        self._filename.changed_event = self.__refreshPreview
        self._startingrow.changed_event = self.__refreshPreview
        self._loadButton.value = self.load

        self._load_event = None
Esempio n. 14
0
    def __init__(self):
        super(Example1, self).__init__('dir examples')
        self.parent = None
        self._directory = ControlDir('Choose a directory')
        self._file = ControlFile('Choose a file')
        self._filetree = ControlFilesTree('Choose a file')
        self._image = ControlImage('Image')
        self._boundaries = ControlBoundingSlider('Bounding', horizontal=True)
        self._button = ControlButton('Click')

        self._button.value = self.onButtonClick
        # self._directory.value=self.onButtonClick

        self._checkbox = ControlCheckBox('Choose a directory')
        self._checkboxList = ControlCheckBoxList('Choose a file')
        self._player = ControlPlayer('Choose a file')
        self._slider = ControlSlider('Slider')
        self._player.show()
        self._checkboxList.value = [('Item 1', True), ('Item 2', False), ('Item 3', True)]

        self._combobox = ControlCombo('Choose a item')
        self._list = ControlList('List label')
        self._progress = ControlProgress('Progress bar')
        self._visvisVolume = ControlVisVisVolume('Visvis')
        self._timeline = ControlEventTimeline('Timeline')

        self._combobox.add_item('Item 1', 'Value 1')
        self._combobox.add_item('Item 2', 'Value 2')
        self._combobox.add_item('Item 3', 'Value 3')
        self._combobox.add_item('Item 4')

        self._list.value = [('Item1', 'Item2', 'Item3',), ('Item3', 'Item4', 'Item5',)]
        imageWithVolume = np.zeros((100, 100, 100), np.uint8)
        imageWithVolume[30:40, 30:50, :] = 255
        imageWithVolume[30:40, 70:72, :] = 255
        self._visvisVolume.value = imageWithVolume

        self._visvis = ControlVisVis('Visvis')
        values1 = [(i, random.random(), random.random()) for i in range(130)]
        values2 = [(i, random.random(), random.random()) for i in range(130)]
        self._visvis.value = [values1, values2]

        self.formset = [
            '_visvis'
            , '_directory'
            , '_button'
            , '_file'
            , '_boundaries'
            , '_filetree'
            , '_image'
            , '_slider'
            , ('_checkboxList', '_player')
            , ('_checkbox', ' ')
            , ('_combobox', ' ')
            , '_progress'
            , '='
            , ('_visvisVolume', '||', '_list')
            , '_timeline'
        ]
Esempio n. 15
0
    def __init__(self,
                 admin=None,
                 connection=None,
                 flag='',
                 uid='',
                 email='',
                 name='',
                 services={}):
        super(UserWidget, self).__init__(uid, email, name, services)
        BaseWidget.__init__(self, 'User')
        self._admin = admin
        self._connection = connection
        self._flag = flag
        self.changes = []  #0 is name change, 1 is services change
        if flag == 'edit':
            self._editBtn = ControlButton('Edit')
            self._editBtn.value = self._edit
        elif flag == 'new':
            self._editBtn = ControlButton('Save')
            self._editBtn.value = self._save
        else:
            self._closeBtn = ControlButton('Close')
            self._closeBtn.value = self._close

        if uid != '':
            self._uid_field = ControlText('User_Key')
            self._uid_field.value = uid
        self._email_field = ControlText('Email')
        self._email_field.readonly = True
        if email != '':
            self._email_field.value = email

        self._name_field = ControlText('Name')
        self._name_field.readonly = True
        if name != '':
            self._name_field.value = name

        self._services = services
        self._services_field = ControlList('Services')
        self._services_field.readonly = True
        self._services_field.horizontal_headers = ['Service', 'Value']
        #self._services_field.cell_double_clicked_event = None
        if services != {}:
            for i in services:
                self._services_field.__add__([i, services[i]])
Esempio n. 16
0
 def __init__(self):
     People.__init__(self)
     BaseWidget.__init__(self, 'People window')
     AddMenuFuntionality.__init__(self)
     self._panel = ControlDockWidget()
     self._peopleList = ControlList('People',
                                    add_function=self.__addPersonBtnAction,
                                    remove_function=self.__rmPersonBtnAction)
     self._peopleList.horizontalHeaders = ['First name', 'Middle name', 'Last name']
    def __init__(self, title, parent=None):
        super(GeometryManualDesigner, self).__init__(title, parent_win=parent)

        self._threshold_win = None
        self._start_point = None
        self._end_point = None

        self._selected_poly = None
        self._selected_point = None

        self._video = ControlFile("Video file")
        self._player = ControlPlayer("Video")
        self._remove = ControlButton("Remove")
        self._square = ControlButton("Square", checkable=True)
        self._circle = ControlButton("Circle", checkable=True)
        self._threshold = ControlButton("Threshold")
        self._export = ControlButton("Export")
        self._import = ControlButton("Import")
        self._polygons = ControlList('Polygons')

        self._apply = ControlButton('Apply')

        self._formset = [
            '_video', "_player",
            ("_square", "_circle", "_threshold", " ", "_remove", " ",
             "_export", "_import"), "=", "_polygons", '_apply'
        ]

        self._video.changedchanged_event = self.videoSelected
        self._square.value = self.square_toggle
        self._circle.value = self.circle_toggle
        self._remove.value = self.remove_clicked
        self._export.value = self.export_clicked
        self._import.value = self.import_clicked
        self._threshold.value = self.threshold_btn_click

        self._player.drag_event = self.on_player_drag_in_video_window
        self._player.end_drag_event = self.on_player_end_drag_in_video_window
        self._player.click_event = self.on_player_click_in_video_window
        self._player.double_click_event = self.on_player_double_click_in_video_window
        self._player.process_frame_event = self.process_frame
        self._player.key_release_event = self.on_player_key_release

        self._apply.hide()
    def __init__(self, setup):
        BaseWidget.__init__(self,
                            "Variables config for {0}".format(setup.name))

        self._var_is_being_added = False

        self._updvars = ControlCheckBox('Update variables')
        self._vars = ControlList('Variables',
                                 add_function=self.__add_variable,
                                 remove_function=self.__remove_variable)

        BoardTask.__init__(self, setup)

        self._vars.horizontal_headers = ['NAME', 'TYPE', 'VALUE']
        self._vars.data_changed_event = self.__varslist_data_changed_evt

        self._formset = ['_updvars', '_vars']

        self._variable_rule = re.compile('^[A-Z0-9\_]+$')
Esempio n. 19
0
    def __init__(self, user = None, connection = None):
        Notifications.__init__(self)
        BaseWidget.__init__(self)
        self._user = user
        self._connection = connection
        self._refresh_button = ControlToolButton('Refresh', maxheight= 50, maxwidth= 100)

        self._notifCache=None
        self._notifList = ControlList('Notifications',
            select_entire_row = True)
        self._notifList.readonly = True
        self._notifList.cell_double_clicked_event = self.__onDouble
        #self._notifList.item_selection_changed_event = self.__softSelect
        self._notifList.horizontal_headers = [ 'Timestamp', 'Symbol', 'Price', 'Message']
        self._notifList.add_popup_menu_option('Edit', function_action= self.__popEdit)
        self._notifList.add_popup_menu_option('Delete', function_action= self.__deleteNotif)

        self._plusBtn = ControlButton('New Notification')
        self._plusBtn.value= self.__addNotifBtnAction
        if self._user!=None and self._connection!=None:
            self._refresh_button.value= self._refresh
            self._retreive_existing()
Esempio n. 20
0
    def __init__(self):
        super().__init__('Student Info')

        self.set_margin(10)

        self.formset = []

        leftside = []

        leftside.append('Target GPA')
        self.slider = ControlSlider('', 2.5, 1.0, 4.0)
        leftside.append('slider')

        leftside.append('Current Enrollment: ')
        leftside.append(str(len(university.students)))

        leftside.append('Max Enrollment: ')
        leftside.append(str(university.capacity()))

        self.pbar = ControlProgress()
        self.pbar.min = 0
        self.pbar.max = university.capacity()
        self.pbar.value = len(university.students)
        leftside.append('pbar')

        leftside.append('Average GPA: ')
        # need to add grad_rate
        leftside.append('2.3')
        leftside.append('Graduation Rate: ')
        leftside.append(str(university.grad_rate))
        leftside.append('Average Morale: ')

        # need to add morale
        leftside.append('78%')

        # need to add morale to value
        self.morale_pbar = ControlProgress()
        self.morale_pbar.min = 0
        self.morale_pbar.max = 100
        self.morale_pbar.value = 78
        leftside.append('morale_pbar')

        self.mylist = ControlList('Students')
        self.mylist.horizontal_headers = ['Name', 'GPA', 'Morale']

        for student in university.students:
            self.mylist += (student.name, student.gpa, student.morale)

        self.formset.append((leftside, ' ', 'mylist'))
    def __init__(self, parent=None):
        BaseWidget.__init__(self, 'Export data', parent_win=parent)

        self.set_margin(5)
        self.setMinimumHeight(600)
        self.setMinimumWidth(800)

        self._tree = ControlTree('Data')
        self._apply = ControlButton('Apply', checkable=True)
        self._progress = ControlProgress('Progress')
        self._add = ControlButton('Add')
        self._remove = ControlButton('Remove')
        self._export_list = ControlList('Columns to export')

        self._outdir = ControlDir('Output directory')
        self._outfile = ControlText('Output file name')

        self._toggleevts = ControlCheckBox('Split files by events')
        self._splitevents = ControlCheckBoxList('Events')
        self._evtsreload = ControlButton('Reload events')

        self._formset = [[['_add', '_tree'], '||',
                          ['_remove', '_export_list']], '_toggleevts',
                         '_evtsreload', '_splitevents', '_outdir', '_outfile',
                         '_apply', '_progress']

        self._add.value = self.__add_column_event
        self._remove.value = self.__remove_column_event
        self._apply.value = self.__apply_btn_event
        self._evtsreload.value = self.__reload_events
        self._outdir.changed_event = self.__update_outfile_name_event
        self._outfile.changed_event = self.__update_outfile_name_event
        self._toggleevts.changed_event = self.__toggleevents_visibility
        self._splitevents.changed_event = self.__update_outfile_name_event
        self._splitevents.selection_changed_event = self.__update_outfile_name_event

        self._tree.show_header = False
        self._apply.icon = conf.ANNOTATOR_ICON_MOTION
        self._evtsreload.icon = conf.ANNOTATOR_ICON_REFRESH
        self._add.icon = conf.ANNOTATOR_ICON_ADD
        self._remove.icon = conf.ANNOTATOR_ICON_REMOVE

        self._progress.hide()
        self._splitevents.hide()
        self._evtsreload.hide()
        self._apply.enabled = False

        self._properties = []
Esempio n. 22
0
    def __init__(self, parent=None):
        super(CsvParserDialog, self).__init__('CSV Choose the columns', parent_win = parent)
        self._filename = None

        # Definition of the forms fields
        self._filename = ControlFile('CSV File')
        self._separator = ControlText('Separator', default=';')
        self._startingrow = ControlNumber('Starting row', default=0)
        self._frameCol = ControlNumber('Frame column', default=0, minumum=0, maximum=100)
        self._xCol = ControlNumber('X column', default=1, minumum=0, maximum=100)
        self._yCol = ControlNumber('Y column', default=2, minumum=0, maximum=100)
        self._zCol = ControlNumber('Z column', default=3, minumum=0, maximum=100)
        self._filePreview = ControlList('Preview')
        self._loadButton = ControlButton('Load')

        self._formset = [('_filename','_startingrow'), ('_separator', '_frameCol', '_xCol', '_yCol', '_zCol', '_loadButton'), '_filePreview']
        self._separator.changed_event = self.__refreshPreview
        self._filename.changed_event  = self.__refreshPreview
        self._startingrow.changed_event = self.__refreshPreview
Esempio n. 23
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        
        self._order = ControlCombo('Order by', label_visible=False, changed_event=self.__load_stats)
        self._table = ControlList('Topics statistics', 
            horizontal_headers=['Topic', 'Users', 'Funds', 'Total funds', 'Average per fund'])

        #self._order.add_item('Topics', 0)
        self._order.add_item('Users', 1)
        self._order.add_item('Funds', 2)
        self._order.add_item('Total funds', 3)
        self._order.add_item('Average per fund', 4)

        self.formset = [
            '_order',
            '_table'
        ]

        self._order.value = 1
        self.__load_stats()
Esempio n. 24
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._file = ControlFileUpload('Web of science file',
                                       field_css='seven wide')
        self._import = ControlButton('Import', default=self.__import_evt)
        self._clear = ControlButton('Clear blacklist',
                                    default=self.__clear_cache_evt,
                                    css='basic red')
        self._list = ControlList(
            'Pubs',
            horizontal_headers=[
                'Errors', 'Authors', 'Title', 'Journal', 'DOI', 'Pub. date',
                'Year'
            ],
            item_selection_changed_event=self.__item_selection_changed_evt)

        self.formset = [
            no_columns('_file', '_import', '_clear'),
            '_list',
        ]
    def __init__(self, _subject=None):
        BaseWidget.__init__(self, self.TITLE, parent_win=_subject.mainwindow)
        AlyxModule.__init__(self)

        self._details_list = ControlList('Alyx subject details', readonly=True)
        self._details_list += ('Nickname', _subject.name)
        #self._details_list += ('URL', _subject.alyx_url)
        self._details_list += ('ID', _subject.alyx_id)
        self._details_list += ('Responsible user',
                               _subject.alyx_responsible_user)
        self._details_list += ('Birth date', _subject.alyx_birth_date)
        self._details_list += ('Age (weeks)', _subject.alyx_age_weeks)
        self._details_list += ('Death date', _subject.alyx_death_date)
        self._details_list += ('Species', _subject.alyx_species)
        self._details_list += ('Sex', _subject.alyx_sex)
        self._details_list += ('Litter', _subject.alyx_litter)
        self._details_list += ('Strain', _subject.alyx_strain)
        self._details_list += ('Source', _subject.alyx_source)
        self._details_list += ('Line', _subject.alyx_line)
        self._details_list += ('Projects',
                               ", ".join(map(str, _subject.alyx_projects))
                               if _subject.alyx_projects else None)
        self._details_list += ('Lab', _subject.alyx_lab)
        self._details_list += ('Genotype',
                               ", ".join(map(str, _subject.alyx_genotype))
                               if _subject.alyx_genotype else None)
        self._details_list += ('Description', _subject.alyx_description)
        self._details_list += ('Alive', _subject.alyx_alive)
        #self._details_list += ('Weighings', ", ".join(map(str, _subject.alyx_weighings)) if _subject.alyx_weighings else None)
        #self._details_list += ('Reference weight', _subject.alyx_reference_weight)
        #self._details_list += ('Water administrations', ", ".join(map(str, _subject.alyx_water_administrations)) if _subject.alyx_water_administrations else None)
        #self._details_list += ('Last water restriction', _subject.alyx_last_water_restriction)
        #self._details_list += ('Expected water', _subject.alyx_expected_water)
        #self._details_list += ('Remaining water', _subject.alyx_remaining_water)

        self.set_margin(10)
        self.setMinimumWidth(500)
        self.setMinimumHeight(560)

        self.formset = ['_details_list']
Esempio n. 26
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._startyear = ControlInteger('Start year')
        self._endyear = ControlInteger('End year')
        self._keypubs = ControlCheckBox('Pub. types', default=False)
        self._pubtypes = ControlAutoComplete('Publications types',
                                             multiple=True,
                                             queryset=PubType.objects.all())
        self._applybtn = ControlButton('Apply', default=self.populate_graph)

        self._linegraph = ControlLineChart('Publications per year')
        #self._journalschart = ControlPieChart('Publications per journal')
        self._journalslist = ControlList(
            'Publications per journal',
            horizontal_headers=['Journals', 'N pubs', '%'])

        self.formset = [
            no_columns('_startyear', '_endyear', '_pubtypes', '_keypubs',
                       '_applybtn'),
            segment('_linegraph'), '_journalslist'
        ]
Esempio n. 27
0
class AlyaGUI(BaseWidget):


    
    def __init__(self):
        super(AlyaGUI,self).__init__('Alya Case Editor')

        #Layer for IO handling
        self._fileio = AlyaFileIO()

        self._log         = ControlTextArea('Log')
        self._fileio.SetLogControl(self.__addlog)



        #Main form fields
        self._casepath     = ControlDir('Case path', default='/home/costa/Downloads/1111')

        self._fileio.SetCasePath(self._casepath._value)


        self._casename    = ControlCombo('Case')

        
        
        
        self._casePathScan = ControlButton('Scan Path')
        self._casePathScan.value = self.___casePathScan_pressed
        
        self._caseReload = ControlButton('Load Case')
        self._caseReload.value = self.___caseReload_pressed
        
        self._casepath.changed_event = self.__casePathChanged
        
        #General tab. Here everythong most important to check
        self._dat_casename = ControlText('Name','')
        self._dat_run_type = ControlText('Run type','')
        self._dat_time_interval = ControlText('Time interval to run','')
        self._dat_number_of_steps = ControlText('Number of steps to run','')

        self._dom_nodal_points = ControlText('Number of points','')
        self._dom_elements = ControlText('Number of all elements','')
        self._dom_number_of_boundary_faces = ControlText('Number of boundary faces','')
        self._dom_mesh_numbers_verify_button = ControlButton('Verify')

        self._dom_types_of_elements = ControlText('Types of elements','')
        self._dom_domain_integration_points = ControlText('Number of integration points','')
        self._ker_density = ControlText('Density','')        
        self._ker_viscosity = ControlText('Viscosity','')        
        self._ker_steps_to_save = ControlText('Every how many steps to save','')        
        self._nsi_boundary_conditions = ControlTextArea('Nastin boundary conditions')
        general_tab = [('_dat_casename','_dat_run_type'),('_dat_time_interval','_dat_number_of_steps'),\
                       ('_dom_nodal_points','_dom_elements','_dom_number_of_boundary_faces','_dom_mesh_numbers_verify_button'),\
                       ('_dom_types_of_elements','_dom_domain_integration_points'),\
                       ('_ker_density','_ker_viscosity'),\
                       '_ker_steps_to_save','_nsi_boundary_conditions']
        
        #Raw casefile tab
        self._FileEditor = ControlTextArea('File editor')
        self._FileEditorSaveButton = ControlButton("Save file")
        self._DatPicker = ControlList('Dat files')
        self._DatPicker.horizontal_headers = ['Filename','Relative Path']
        self._DatPicker.item_selection_changed_event = self.__DAT_selection_changed
        self._DatPicker.readonly = True
        
        self._IncludedFilePicker = ControlList('Included files')
        self._IncludedFilePicker.horizontal_headers = ['Filename','Section']
        self._IncludedFilePicker.readonly = True
        self._IncludedFilePicker.item_selection_changed_event = self.__INCLUDE_selection_changed
        
        
        self.formset = [ ('_casepath','_casePathScan','||','_casename','_caseReload'),\
                        {'General': general_tab, \
                         'Raw Casefile':[('_FileEditor','||','_DatPicker','||','_IncludedFilePicker'),\
                         '_FileEditorSaveButton']},'=','_log']    

        self._log.autoscroll = True
        self._log.readonly = True
        
        
    def ___fill_general_tab(self, params):
        self._dat_casename.value = params['alya']
        self._dat_run_type.value = params['run_type']
        self._dat_time_interval.value = params['time_interval']
        self._dat_number_of_steps.value = params['number_of_steps']
        self._dom_nodal_points.value = params['nodal_points']
        self._dom_elements.value = params['elements']
        self._dom_number_of_boundary_faces.value = params['boundaries']
        self._dom_types_of_elements.value = params['types_of_elements']
        self._dom_domain_integration_points.value = params['domain_integration_points']
        self._ker_density.value = params['density']
        self._ker_viscosity.value = params['viscosity']
        self._ker_steps_to_save.value = params['steps']
        self._nsi_boundary_conditions.value = params['nsi_boundary_conditions']

        
    def ___caseReload_pressed(self):
        #
        # Reload the case
        #
        self.__addlog(f'Loading case {self._casename.value}')
        
        params = self._fileio.ExtractImportantParameters( self._casename.value )
        self.__addlog(f'Loaded parameters {params}')
        self.___fill_general_tab(params)


    def ___casePathScan_pressed(self):
        #
        # Scan path for the cases, fill the listbox of cases
        # Not fully implmented. Does not support more than one case per path yet
        #
        self._fileio.SetCasePath(self._casepath._value)
        self.__addlog(f'Scanning {self._casepath._value} for cases')
        
        cases = self._fileio.ListCases()
        self.__addlog(f'Found the following cases {cases}')

        self._casename.clear()
        if cases!=[]:
            for case in cases:
                self._casename.add_item(case)
                
            self._casename.current_index = 0
            self.___caseReload_pressed()
            
            dats = self._fileio.ListDats()
            self._DatPicker.clear()

            for dat in dats:
                self._DatPicker += [dat, '.'] 
       
    
    def __casePathChanged(self):
        self.__addlog(f'Case path changed to: {self._casepath._value}')
        self.___casePathScan_pressed()
        return True
    
    def __addlog(self, string):
        self._log.__add__(f'{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}: {string}')
        
        

    def __INCLUDE_selection_changed(self):
        #
        # Activated when user clicks on an INCLUDED file
        #
        selection = self._IncludedFilePicker.get_currentrow_value()        
        print(selection[0])
        data = self._fileio.ReadFullFile( selection[0] )

        self._FileEditor.value = ''
        if data!=[]:
            self._FileEditor.value = ''.join(data)

        
    def __DAT_selection_changed(self):
        #
        # Activated when user clicks on a dat file
        #
        selection = self._DatPicker.get_currentrow_value()   
        data = self._fileio.ReadFullFile( os.path.join(selection[1],selection[0]) )
        
        includes = self._fileio.FindAllIncludedFiles(selection[0])
        self.__addlog(f'Found {includes} included files')
        
        self._IncludedFilePicker.clear()
        if includes!=[]:
            for include in includes:
                self._IncludedFilePicker += [include[0], include[1]] 
            
        
        
        self._FileEditor.value = ''
        if data!=[]:
            self._FileEditor.value = ''.join(data)
Esempio n. 28
0
class CinemaManager(BaseWidget):

    def __init__(self, *args, **kwargs):
        super().__init__('Cinema manager')

        self._pesel = ""
        self._client = Client('http://localhost:8080/projekt?wsdl')
        self._selected_date = date.today()

        # Screening window
        self._search_screenings_button = ControlButton("Search")
        self._screening_day = ControlNumber("Day:", default=self._selected_date.day, minimum=1,
                                            maximum=monthrange(self._selected_date.year, self._selected_date.month)[1],
                                            changed_event=self._change_day)
        self._screening_month = ControlNumber("Month:", default=self._selected_date.month, minimum=1,
                                              maximum=12, changed_event=self._change_month)
        self._screening_year = ControlNumber("Year:", default=self._selected_date.year,
                                             minimum=self._selected_date.year,
                                             maximum=self._selected_date.year + 1,
                                             changed_event=self._change_day)
        self._screening_list = ControlList('Screenings', readonly=True, select_entire_row=True,
                                           cell_double_clicked_event=self._screening_changed_event)
        self._screening_list.horizontal_headers = ['Time', 'Movie', 'Description']
        self._all_showings = self._client.service.getShowingsByDate(self._selected_date.year, self._selected_date.month,
                                                                    self._selected_date.day)
        self._search_screenings_button.value = self._searchScreeningsButton

        for showing in self._all_showings:
            self._screening_list += [showing.date.strftime("%H:%M"), str(showing.movie.title),
                                     str(showing.movie.description)]

        # Client window
        self._all_reservations = []

        self._reservation_list = ControlList('Reservations', readonly=True, select_entire_row=True,
                                             cell_double_clicked_event=self._reservation_changed_event)
        self._reservation_list.horizontal_headers = ['Date', 'Time', 'Movie', 'Seats', 'Paid']
        self._screening_panel = ControlDockWidget()
        self._screening_panel.hide()
        self._reservation_panel = ControlDockWidget()
        self._reservation_panel.hide()
        self._loginWindow = LoginWindow(self._client)
        self.hide()
        self._loginWindow.parent = self
        self._loginWindow.show()
        print(self._client.service)
        # Define the organization of the Form Controls
        self.formset = [{
            'a:Screening': [('_screening_day', '_screening_month', '_screening_year', '_search_screenings_button'), '=',
                            '_screening_list'],
            'b:Client': ['_reservation_list']
        },
        ]

    def _screening_changed_event(self, row, column):
        self._all_showings = self._client.service.getShowingsByDate(self._selected_date.year, self._selected_date.month,
                                                                    self._selected_date.day)
        print(self._all_showings)
        win = ScreeningWindow(self._all_showings[row], self._client, self._pesel)
        win.parent = self
        self._screening_panel.show()
        self._reservation_panel.hide()
        self._screening_panel.label = "Screening info"
        self._screening_panel.value = win

    def _reservation_changed_event(self, row, column):
        self._all_reservations = self._client.service.getUserReservationsByPesel(self._pesel)
        win = ClientReservationWindow(self._all_reservations[row], self._client)
        win.parent = self
        self._screening_panel.hide()
        self._reservation_panel.show()
        self._reservation_panel.label = "Reservation details"
        self._reservation_panel.value = win

    def setUserPesel(self,pesel):
        self._pesel = pesel
        self.updateInfo()

    def updateInfo(self):
        self._screening_list.clear()
        self._all_showings = self._client.service.getShowingsByDate(self._selected_date.year, self._selected_date.month,
                                                                    self._selected_date.day)
        for show in self._all_showings:
            self._screening_list += [show.date.strftime("%H:%M"), str(show.movie.title),
                                     str(show.movie.description)]
        self._reservation_list.clear()
        self._all_reservations = self._client.service.getUserReservationsByPesel(self._pesel)
        for reservation in self._all_reservations:
            self._reservation_list += [reservation['showing']['date'].strftime("%d-%m-%Y"),
                                       reservation['showing']['date'].strftime("%H:%M"),
                                       str(reservation['showing']['movie']['title']), str(reservation['places']),
                                       "Yes" if reservation['isPaid'] is True else "No"]

    def _searchScreeningsButton(self):
        self._screening_list.clear()
        self._all_showings = self._client.service.getShowingsByDate(self._selected_date.year, self._selected_date.month,
                                                                    self._selected_date.day)
        for show in self._all_showings:
            self._screening_list += [show.date.strftime("%H:%M"), str(show.movie.title),
                                     str(show.movie.description)]

    def _change_day(self):
        self._selected_date = self._selected_date.replace(day=int(self._screening_day.value))

    def _change_month(self):
        self._selected_date = self._selected_date.replace(month=int(self._screening_month.value), day=1)
        self._screening_day.max = monthrange(self._selected_date.year, self._selected_date.month)[1]
        self._screening_day.value = 1
Esempio n. 29
0
class NotificationsWidget(Notifications, BaseWidget):
    def __init__(self, user = None, connection = None):
        Notifications.__init__(self)
        BaseWidget.__init__(self)
        self._user = user
        self._connection = connection
        self._refresh_button = ControlToolButton('Refresh', maxheight= 50, maxwidth= 100)

        self._notifCache=None
        self._notifList = ControlList('Notifications',
            select_entire_row = True)
        self._notifList.readonly = True
        self._notifList.cell_double_clicked_event = self.__onDouble
        #self._notifList.item_selection_changed_event = self.__softSelect
        self._notifList.horizontal_headers = [ 'Timestamp', 'Symbol', 'Price', 'Message']
        self._notifList.add_popup_menu_option('Edit', function_action= self.__popEdit)
        self._notifList.add_popup_menu_option('Delete', function_action= self.__deleteNotif)

        self._plusBtn = ControlButton('New Notification')
        self._plusBtn.value= self.__addNotifBtnAction
        if self._user!=None and self._connection!=None:
            self._refresh_button.value= self._refresh
            self._retreive_existing()



    def _refresh(self):
        self._notifList.clear()
        self._retreive_existing()
        if self.parent!=None: self.parent.persist_login()

    def _retreive_existing(self):
        try:
            pull_list = pull_notifications(self._user, self._connection)
            self._notifCache=pull_list
        except ValueError as err:
            err= ErrorWin(err)
            err.parent = self
            err.show()
            return
        if pull_list:
            for i in pull_list:
                ts = pull_list[i]['timestamp']
                datestring=datetime.fromtimestamp(ts/1e3).strftime('%Y-%m-%d %H:%M:%S')
                self._notifList.__add__([datestring, pull_list[i]['symbol'], pull_list[i]['price'], pull_list[i]['message']])


    def __addNotifBtnAction(self):
        if self.parent!=None: self.parent.persist_login()
        win = NotificationWidget(self._user, self._connection, '', '', '', '', 'new')
        win.parent = self
        win.show()



    def __rmNotifBtnAction(self):
        self.__deleteNotif(self)

    def __onDouble(self, row, column):
        if self.parent!=None: self.parent.persist_login()
        timestamp = self._notifList.get_value(0, row)
        symbol = self._notifList.get_value(1, row)
        index = self._notifList.get_value(2, row)
        message = self._notifList.get_value(3, row)
        win = NotificationWidget(self._user, self._connection, timestamp, symbol, index, message, 'view')
        win.parent = self
        win.show()

    def __popEdit(self):
        row = self._notifList.selected_row_index
        timestamp = self._notifList.get_value(0, row)
        symbol = self._notifList.get_value(1, row)
        index = self._notifList.get_value(2, row)
        message = self._notifList.get_value(3, row)
        for i in self._notifCache:
            if self._notifCache[i]['message']== message:
                key = i
                #print("popedit key found: " + key)
        win = NotificationWidget(self._user, self._connection, timestamp, symbol, index, message, "edit", key)
        win.parent = self
        win.show()


    def __softSelect(self, row, column):
        self._notifList.form.get_value(row, column)

    def __deleteNotif(self):
        row = self._notifList.selected_row_index
        message = self._notifList.get_value(3, row)
        for i in self._notifCache:
            if self._notifCache[i]['message']== message:
                key= i
        try:
            del_notification(self._user, self._connection, key)
            self._notifList.__sub__(row)
        except ValueError as error:
            err= ErrorWin(error)
            err.parent = self
            err.show()
            return
    def __init__(self, screening_info: dict, client: Client, pesel: str):
        BaseWidget.__init__(self, 'Person window')
        # Definition of the forms fields
        self._screening_info = screening_info
        self._client = client
        self._pesel = pesel
        self._image = self._client.service.getImage(
            self._screening_info['movie']['id_movie'])
        image_open = Image.open(io.BytesIO(self._image))
        rgb_im = image_open.convert('RGB')
        if not os.path.exists("../resources/images"):
            os.makedirs("../resources/images")
        rgb_im.save(
            f'../resources/images/{str(self._screening_info["movie"]["id_movie"])}.jpg'
        )
        self._dateField = ControlText(
            'Date',
            enabled=False,
            default=self._screening_info['date'].strftime("%d-%m-%Y"))
        self._timeField = ControlText(
            'Time',
            enabled=False,
            default=self._screening_info['date'].strftime("%H:%M"))
        self._titleField = ControlText(
            'Title',
            enabled=False,
            default=self._screening_info['movie']['title'])
        self._descriptionField = ControlTextArea(
            'Description',
            enabled=False,
            default=self._screening_info['movie']['description'])
        self._actorField = ControlList('Actors', enabled=False)
        self._actorField.horizontal_headers = ['Name', 'Surname']
        for actor in self._screening_info['movie']['actors']:
            self._actorField += [actor['firstName'], actor['secondName']]
        self._directorField = ControlList("Director", enabled=False)
        self._directorField.horizontal_headers = ['Name', 'Surname']
        self._directorField += [
            self._screening_info['movie']['director']['firstName'],
            self._screening_info['movie']['director']['secondName']
        ]
        self._imageField = ControlImage('Poster')
        self._imageField.value = cv2.imread(
            f'../resources/images/{str(self._screening_info["id_showing"])}.jpg'
        )
        self._freeSeatsField = ControlTextArea(
            'Free seats',
            enabled=False,
            default=self._screening_info['freePlaces'])
        self._chosenSeatsField = ControlText(
            'Chosen seats (write down the numbers and separate them with ";")')
        self._buttonField = ControlButton('Reserve')
        self._panel = ControlDockWidget()
        # Define the button action
        self._buttonField.value = self.__buttonAction

        self.formset = [('_dateField', '_timeField'),
                        ('_imageField', ['_titleField', '_descriptionField']),
                        ('_directorField', '_actorField'),
                        ('_freeSeatsField', '_chosenSeatsField'),
                        '_buttonField', '_panel']
Esempio n. 31
0
    def __init__(self, experiment=None):
        """

        :param experiment: Experiment this setup belongs to.
        """
        BaseWidget.__init__(self, 'Experiment')
        self.layout().setContentsMargins(5, 10, 5, 5)

        self._name = ControlText('Setup name')
        self._board = ControlCombo('Board')

        self._stoptrial_btn = ControlButton('Skip trial',
                                            default=self._stop_trial_evt)
        self._pause_btn = ControlButton('Pause',
                                        checkable=True,
                                        default=self._pause_evt)
        self._run_task_btn = ControlButton(
            'Run',
            checkable=True,
            default=self._run_task,
            helptext=
            "When a task is running, you can stop all remaining trials by pressing this button. <br/> <b>NOTE:</b> This means that you will need to break the cycle yourself in your task code when the run_state_machine method returns False."
        )
        self._kill_task_btn = ControlButton(
            'Kill',
            default=self._kill_task,
            style="background-color:rgb(255,0,0);font-weight:bold;",
            helptext=
            "<b>NOTE:</b>This will exit the task process abruptly. The code you might have after the trial loop won't execute."
        )

        self._subjects_list = ControlList(
            'Subjects', remove_function=self.__remove_subject)
        self._add_subject = ControlButton('Add subject')
        self._allsubjects = ControlCombo('Add subject')
        self._task = ControlCombo('Protocol',
                                  changed_event=self._task_changed_evt)

        self._detached = ControlCheckBox('Detach from GUI')

        self._varspanel = ControlEmptyWidget()
        self._btn = ControlButton('Open')

        Setup.__init__(self, experiment)

        self.reload_setups()
        self.reload_boards()
        self.reload_tasks()

        self._formset = [
            '_name',
            '_board',
            '_task',
            '_detached',
            ('_run_task_btn', '_kill_task_btn'),
            ('_stoptrial_btn', '_pause_btn'),
            #' ',
            {
                'Subjects': [
                    # '_allsubjects',
                    '',
                    '_add_subject',
                    '_subjects_list',
                ],
                'Variables': [
                    '_varspanel',
                ],
            }
        ]

        self._kill_task_btn.enabled = False
        self._subjects_list.readonly = True
        self._varspanel.value = self.board_task
        self._add_subject.value = self.__add_subject
        self._name.changed_event = self.__name_changed_evt
        self._board.changed_event = self._board_changed_evt
Esempio n. 32
0
    def __init__(self):
        super(AlyaGUI,self).__init__('Alya Case Editor')

        #Layer for IO handling
        self._fileio = AlyaFileIO()

        self._log         = ControlTextArea('Log')
        self._fileio.SetLogControl(self.__addlog)



        #Main form fields
        self._casepath     = ControlDir('Case path', default='/home/costa/Downloads/1111')

        self._fileio.SetCasePath(self._casepath._value)


        self._casename    = ControlCombo('Case')

        
        
        
        self._casePathScan = ControlButton('Scan Path')
        self._casePathScan.value = self.___casePathScan_pressed
        
        self._caseReload = ControlButton('Load Case')
        self._caseReload.value = self.___caseReload_pressed
        
        self._casepath.changed_event = self.__casePathChanged
        
        #General tab. Here everythong most important to check
        self._dat_casename = ControlText('Name','')
        self._dat_run_type = ControlText('Run type','')
        self._dat_time_interval = ControlText('Time interval to run','')
        self._dat_number_of_steps = ControlText('Number of steps to run','')

        self._dom_nodal_points = ControlText('Number of points','')
        self._dom_elements = ControlText('Number of all elements','')
        self._dom_number_of_boundary_faces = ControlText('Number of boundary faces','')
        self._dom_mesh_numbers_verify_button = ControlButton('Verify')

        self._dom_types_of_elements = ControlText('Types of elements','')
        self._dom_domain_integration_points = ControlText('Number of integration points','')
        self._ker_density = ControlText('Density','')        
        self._ker_viscosity = ControlText('Viscosity','')        
        self._ker_steps_to_save = ControlText('Every how many steps to save','')        
        self._nsi_boundary_conditions = ControlTextArea('Nastin boundary conditions')
        general_tab = [('_dat_casename','_dat_run_type'),('_dat_time_interval','_dat_number_of_steps'),\
                       ('_dom_nodal_points','_dom_elements','_dom_number_of_boundary_faces','_dom_mesh_numbers_verify_button'),\
                       ('_dom_types_of_elements','_dom_domain_integration_points'),\
                       ('_ker_density','_ker_viscosity'),\
                       '_ker_steps_to_save','_nsi_boundary_conditions']
        
        #Raw casefile tab
        self._FileEditor = ControlTextArea('File editor')
        self._FileEditorSaveButton = ControlButton("Save file")
        self._DatPicker = ControlList('Dat files')
        self._DatPicker.horizontal_headers = ['Filename','Relative Path']
        self._DatPicker.item_selection_changed_event = self.__DAT_selection_changed
        self._DatPicker.readonly = True
        
        self._IncludedFilePicker = ControlList('Included files')
        self._IncludedFilePicker.horizontal_headers = ['Filename','Section']
        self._IncludedFilePicker.readonly = True
        self._IncludedFilePicker.item_selection_changed_event = self.__INCLUDE_selection_changed
        
        
        self.formset = [ ('_casepath','_casePathScan','||','_casename','_caseReload'),\
                        {'General': general_tab, \
                         'Raw Casefile':[('_FileEditor','||','_DatPicker','||','_IncludedFilePicker'),\
                         '_FileEditorSaveButton']},'=','_log']    

        self._log.autoscroll = True
        self._log.readonly = True