def nd_Control(self, targets):
     'Control of the N & D menu'
     
     # (1) Updating the current selected button
     self.selected_icon = self.current_icons.pop(0)
     self.current_icons.append(self.selected_icon)
     # (2) Subutton labels modification
     ## -- current sublabel
     self.submenu_labels[self.selected_subutton].modify_font(pango.FontDescription(medium_font))  
     ## -- next sublabel pre-deselection
     self.submenu_labels[self.current_subuttons[0]].modify_font(pango.FontDescription(medium_font))               
     ## a.- Cue-Driven Systems
     if targets[-1] == self.selected_icon:
         for index in range(8): 
             ## -- original label
             label = MainMenu[self.selected_icon][index]
             ## -- underline~process for Cue-Driven systems
             if any([target==index for target in targets[:-1]]):
                 # label creation
                 labels = label.split('\n')
                 for i in range(len(labels)): labels[i] = labels[i].replace('','_')[:-1]
                 label = '\n'.join(labels)                
                 # re-design of the subutton
                 self.table.remove(self.submenu_buttons[index])
                 Button, Label = Button_Label(label, blue, 'white', medium_font)
                 Label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
                 self.table.attach(Button, index, index+1, 6, 8)
                 # button & label re-assignment
                 self.submenu_buttons[index], self.submenu_labels[index] = Button, Label                    
             ## -- submenu-labelling
             else:
                 self.submenu_labels[index].set_label(label)          
     ## b.- Systems different to Cue-Driven systems
     else:       
         for index in range(8): self.submenu_labels[index].set_label(MainMenu[self.selected_icon][index])                   
     # (3) Selection and deselection in main menu
     ## -- current icon label selection
     self.mainmenu_labels[self.selected_icon].modify_fg(gtk.STATE_NORMAL,gtk.gdk.color_parse(blue))
     self.mainmenu_labels[self.selected_icon].modify_font(pango.FontDescription(medium_font))
     ## -- last icon label deselection
     self.mainmenu_labels[self.current_icons[6]].modify_fg(gtk.STATE_NORMAL,gtk.gdk.color_parse('black'))
     self.mainmenu_labels[self.current_icons[6]].modify_font(pango.FontDescription(medium_font))
     ## -- last event_box background deselection
     STYLE = self.mainmenu_events[self.current_icons[6]].get_style().copy()
     STYLE.bg[gtk.STATE_NORMAL] = \
     self.mainmenu_events[self.current_icons[6]].get_colormap().alloc_color(ground)
     self.mainmenu_events[self.current_icons[6]].set_style(STYLE)        
     ## -- current event_box background selection
     STYLE = self.mainmenu_events[self.selected_icon].get_style().copy()
     STYLE.bg[gtk.STATE_NORMAL]= self.mainmenu_events[self.selected_icon].get_colormap().alloc_color(blue)
     self.mainmenu_events[self.selected_icon].set_style(STYLE)    
    ## -- different icons from 'Home'
     if (self.selected_icon != 0) and (self.selected_icon != 4):
         ## a.- commands belong to main menu
         return False
     else: 
         ## b.- commands could belong to general menu
         return True
    def HCI_InstON(self, m, i, idx, codes):
        """Appending the Instructions to follow the Next Target in 
           "Target-Driven System" according to the current Tab"""

        ## -- Variable Declaration
        message = Label("", "Elephant 17", "orange", 0, 0.5, gtk.JUSTIFY_LEFT)
        self.container.attach(message, 1, 2, 0, 2)
        ## -- Label Update
        if all([codes[0] == "230", idx == 0]):
            message.set_text(m.replace(" Done", "come"))
        elif all([codes[0] == "230", idx == 1]):
            message.set_text(m.replace("Next", "First"))
        else:
            message.set_text(m)
        ## -- image widget
        cartoon = Image(i)
        cartoon.set_alignment(xalign=0.9, yalign=0.5)
        self.container.attach(cartoon, 0, 1, 0, 2)
        ## -- reset variables
        self.message = message
        self.cartoon = cartoon
        self.ready = True
        return False
    def __init__(self):        
        'Initial method to generate the "Environment Control" menu'
        
        # ======== Environment Control tab creation=========        
        # (1) TABLE: Widget container
        ## --9 x 8 table creation
        self.table = gtk.Table(9, 8, True)
        self.table.show()

        # (2) LABEL: Window title
        titulo = Label('Environment\nControl', 'Neuropol 31', orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        self.table.attach(titulo, 6, 8, 0, 2)        

        # (3) FRAMES & IMAGES: General menu images
        GralIconsON = []
        ## --'Necessities and Desires' option
        url = 'Images\\Necessity&Desire\\SNecessities_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[0], 2, 3, 0, 2)
        ## --'Mobility' option
        url = 'Images\\Mobility\\SMobility_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[1], 3, 4, 0, 2)
        ## --'Environmental Control' option
        url = 'Images\\EnvControl\\LHomeControl_on.png'
        EC_event, EC_image = Event_Image(url, ground)
        EC_event.set_border_width(10)
        GralIconsON.append(EC_image)
        self.table.attach(EC_event, 4, 5, 0, 2)
        ## --'Messenger' option
        url = 'Images\\Messenger\\SChat_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[3], 5, 6, 0, 2)
        
        # (4) IMAGES: Icons for cue indication
        CueSignals = []
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\left.png'
        image = Image(url)
        CueSignals.append(image)        
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\right.png'
        image = Image(url)
        CueSignals.append(image) 
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\idle.png'
        image = Image(url)
        CueSignals.append(image)  
        
        # (5) LABELS: Icon labels for main menu
        mainmenu_labels, x, y = [], 1, 4
        # --- exit
        label = Label('Exit', medium_font, lblue, 0.1, 0.8, gtk.JUSTIFY_LEFT)
        self.table.attach(label,0, 2, 2, 4)        
        mainmenu_labels.append(label)
        # --- switch room
        label = Label('Switch\nRoom', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        self.table.attach(label, 0, 3, 2, 4)       
        mainmenu_labels.append(label)
        # --- rooms
        # room label        
        self.table.attach(Image('Images\\EnvControl\\border.png'), 2, 6, 2, 3)
        Current_Room = Label(ROOMS[0], 'Neuropol 20', "#644080", 0.5, 0.5, gtk.JUSTIFY_CENTER)
        self.table.attach(Current_Room, 6, 8, 2, 3)
        # internal items
        Rooms = ['Blinds ||\nCurtains','Doors','Heating','Light','Stereo  ||\nTelevision','Windows']
        for room in Rooms[:-1]:
            label = Label(room, medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
            self.table.attach(label, x, y, 2, 4)            
            mainmenu_labels.append(label) 
            x += 1
            y += 1                    
        # last item
        label = Label(Rooms[-1], medium_font, lblue, 0.9, 0.8, gtk.JUSTIFY_RIGHT)
        self.table.attach(label, 6, 8, 2, 4)            
        mainmenu_labels.append(label)
        
        # (6) EVENTS & IMAGES: main menu images
        mainmenu_events, mainmenu_imagesOFF, x, y = [], [], 0, 1
        URLs = ['Images\\EnvControl\\Exit_off.png',\
                'Images\\EnvControl\\Switch_off.png',\
                'Images\\EnvControl\\Curtains_off.png',\
                'Images\\EnvControl\\Door_off.png',\
                'Images\\EnvControl\\Heating_off.png',\
                'Images\\EnvControl\\Light_off.png',\
                'Images\\EnvControl\\Television_off.png',\
                'Images\\EnvControl\\Windows_off.png']
        for url in URLs:
            eventbox, image = Event_Image(url, ground)
            self.table.attach(eventbox, x, y, 4, 6)
            mainmenu_events.append(eventbox)
            mainmenu_imagesOFF.append(image)
            x += 1
            y += 1 

        # (7) BUTTONS: list of EC Tasks
        submenu_labels, submenu_buttons= [], []
        for x in range(0,8):
            button, label = Button_Label('', lblue, 'white', medium_font)
            label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
            self.table.attach(button, x, x+1, 6, 8)
            submenu_labels.append(label)
            submenu_buttons.append(button)       
        
        # (8) IMAGES: general menu images for OFF state
        GralIconsOFF = []
        GralIconsOFF.append(Image('Images\\Necessity&Desire\\SNecessities_off.png')) 
        GralIconsOFF.append(Image('Images\\Mobility\\SMobility_off.png'))
        GralIconsOFF.append(Image('Images\\EnvControl\\LHomeControl_off.png'))
        GralIconsOFF.append(Image('Images\\Messenger\\SChat_off.png'))         
        
        # (9) IMAGES: main menu images for ON state
        mainmenu_imagesON = [] 
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Switch_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Curtains_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Door_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Heating_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Light_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Television_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Windows_on.png'))
        
        # (10) IMAGE: general menu image for MI state
        self.EC_MI = Image('Images\\EnvControl\\LHomeControl_MI.png')    
        
        #(11) FRAME & LABELS: history of the selected tasks
        frame, label = Frame_Label('HISTORY - Recently Selected Tasks', ground, lblue, small_font, 0, 0.5, gtk.JUSTIFY_CENTER)
        self.table.attach(frame, 0, 8, 8, 9)    
        History_Labels = []
        History_Labels.append(Label('', small_font, 'black', 0.1, 0.9, gtk.JUSTIFY_LEFT))
        self.table.attach(History_Labels[0], 0, 1, 8, 9)
        for index in range(1,8):
            History_Labels.append(Label('', small_font, lblue, 0.1, 0.9, gtk.JUSTIFY_LEFT))
            self.table.attach(History_Labels[index], index, index+1, 8, 9)              
            
        # (12) Widgets assignation to enable them in the following
        #     methods        
        # -- ButtonS
        self.submenu_buttons = submenu_buttons
        # -- ImageS
        self.GralIconsON  = GralIconsON
        self.GralIconsOFF = GralIconsOFF        
        self.mainmenu_imagesOFF = mainmenu_imagesOFF
        self.mainmenu_imagesON  = mainmenu_imagesON
        # -- Events        
        self.mainmenu_events = mainmenu_events
        # -- FrameS
        self.EC_event = EC_event
        # -- LabelS
        self.CueSignals = CueSignals
        self.Current_Room = Current_Room
        self.titulo = titulo
        self.mainmenu_labels = mainmenu_labels        
        self.submenu_labels = submenu_labels
        self.History_Labels = History_Labels
        # -- Variable Declaration
        self.History, self.CUE = ['','','','','','','',''], None
Esempio n. 4
0
    def __init__(self):
        'Initial method to generate the "Environment Control" menu'

        # ======== Environment Control tab creation=========
        # (1) TABLE: Widget container
        ## --9 x 8 table creation
        self.table = gtk.Table(9, 8, True)
        self.table.show()

        # (2) LABEL: Window title
        titulo = Label('Environment\nControl', 'Neuropol 31', orange, 0.5, 0.5,
                       gtk.JUSTIFY_CENTER)
        self.table.attach(titulo, 6, 8, 0, 2)

        # (3) FRAMES & IMAGES: General menu images
        GralIconsON = []
        ## --'Necessities and Desires' option
        url = 'Images\\Necessity&Desire\\SNecessities_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[0], 2, 3, 0, 2)
        ## --'Mobility' option
        url = 'Images\\Mobility\\SMobility_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[1], 3, 4, 0, 2)
        ## --'Environmental Control' option
        url = 'Images\\EnvControl\\LHomeControl_on.png'
        EC_event, EC_image = Event_Image(url, ground)
        EC_event.set_border_width(10)
        GralIconsON.append(EC_image)
        self.table.attach(EC_event, 4, 5, 0, 2)
        ## --'Messenger' option
        url = 'Images\\Messenger\\SChat_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[3], 5, 6, 0, 2)

        # (4) IMAGES: Icons for cue indication
        CueSignals = []
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\left.png'
        image = Image(url)
        CueSignals.append(image)
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\right.png'
        image = Image(url)
        CueSignals.append(image)
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\idle.png'
        image = Image(url)
        CueSignals.append(image)

        # (5) LABELS: Icon labels for main menu
        mainmenu_labels, x, y = [], 1, 4
        # --- exit
        label = Label('Exit', medium_font, lblue, 0.1, 0.8, gtk.JUSTIFY_LEFT)
        self.table.attach(label, 0, 2, 2, 4)
        mainmenu_labels.append(label)
        # --- switch room
        label = Label('Switch\nRoom', medium_font, lblue, 0.5, 0.8,
                      gtk.JUSTIFY_CENTER)
        self.table.attach(label, 0, 3, 2, 4)
        mainmenu_labels.append(label)
        # --- rooms
        # room label
        self.table.attach(Image('Images\\EnvControl\\border.png'), 2, 6, 2, 3)
        Current_Room = Label(ROOMS[0], 'Neuropol 20', "#644080", 0.5, 0.5,
                             gtk.JUSTIFY_CENTER)
        self.table.attach(Current_Room, 6, 8, 2, 3)
        # internal items
        Rooms = [
            'Blinds ||\nCurtains', 'Doors', 'Heating', 'Light',
            'Stereo  ||\nTelevision', 'Windows'
        ]
        for room in Rooms[:-1]:
            label = Label(room, medium_font, lblue, 0.5, 0.8,
                          gtk.JUSTIFY_CENTER)
            self.table.attach(label, x, y, 2, 4)
            mainmenu_labels.append(label)
            x += 1
            y += 1
        # last item
        label = Label(Rooms[-1], medium_font, lblue, 0.9, 0.8,
                      gtk.JUSTIFY_RIGHT)
        self.table.attach(label, 6, 8, 2, 4)
        mainmenu_labels.append(label)

        # (6) EVENTS & IMAGES: main menu images
        mainmenu_events, mainmenu_imagesOFF, x, y = [], [], 0, 1
        URLs = ['Images\\EnvControl\\Exit_off.png',\
                'Images\\EnvControl\\Switch_off.png',\
                'Images\\EnvControl\\Curtains_off.png',\
                'Images\\EnvControl\\Door_off.png',\
                'Images\\EnvControl\\Heating_off.png',\
                'Images\\EnvControl\\Light_off.png',\
                'Images\\EnvControl\\Television_off.png',\
                'Images\\EnvControl\\Windows_off.png']
        for url in URLs:
            eventbox, image = Event_Image(url, ground)
            self.table.attach(eventbox, x, y, 4, 6)
            mainmenu_events.append(eventbox)
            mainmenu_imagesOFF.append(image)
            x += 1
            y += 1

        # (7) BUTTONS: list of EC Tasks
        submenu_labels, submenu_buttons = [], []
        for x in range(0, 8):
            button, label = Button_Label('', lblue, 'white', medium_font)
            label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
            self.table.attach(button, x, x + 1, 6, 8)
            submenu_labels.append(label)
            submenu_buttons.append(button)

        # (8) IMAGES: general menu images for OFF state
        GralIconsOFF = []
        GralIconsOFF.append(
            Image('Images\\Necessity&Desire\\SNecessities_off.png'))
        GralIconsOFF.append(Image('Images\\Mobility\\SMobility_off.png'))
        GralIconsOFF.append(Image('Images\\EnvControl\\LHomeControl_off.png'))
        GralIconsOFF.append(Image('Images\\Messenger\\SChat_off.png'))

        # (9) IMAGES: main menu images for ON state
        mainmenu_imagesON = []
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Switch_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Curtains_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Door_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Heating_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Light_on.png'))
        mainmenu_imagesON.append(
            Image('Images\\EnvControl\\Television_on.png'))
        mainmenu_imagesON.append(Image('Images\\EnvControl\\Windows_on.png'))

        # (10) IMAGE: general menu image for MI state
        self.EC_MI = Image('Images\\EnvControl\\LHomeControl_MI.png')

        #(11) FRAME & LABELS: history of the selected tasks
        frame, label = Frame_Label('HISTORY - Recently Selected Tasks', ground,
                                   lblue, small_font, 0, 0.5,
                                   gtk.JUSTIFY_CENTER)
        self.table.attach(frame, 0, 8, 8, 9)
        History_Labels = []
        History_Labels.append(
            Label('', small_font, 'black', 0.1, 0.9, gtk.JUSTIFY_LEFT))
        self.table.attach(History_Labels[0], 0, 1, 8, 9)
        for index in range(1, 8):
            History_Labels.append(
                Label('', small_font, lblue, 0.1, 0.9, gtk.JUSTIFY_LEFT))
            self.table.attach(History_Labels[index], index, index + 1, 8, 9)

        # (12) Widgets assignation to enable them in the following
        #     methods
        # -- ButtonS
        self.submenu_buttons = submenu_buttons
        # -- ImageS
        self.GralIconsON = GralIconsON
        self.GralIconsOFF = GralIconsOFF
        self.mainmenu_imagesOFF = mainmenu_imagesOFF
        self.mainmenu_imagesON = mainmenu_imagesON
        # -- Events
        self.mainmenu_events = mainmenu_events
        # -- FrameS
        self.EC_event = EC_event
        # -- LabelS
        self.CueSignals = CueSignals
        self.Current_Room = Current_Room
        self.titulo = titulo
        self.mainmenu_labels = mainmenu_labels
        self.submenu_labels = submenu_labels
        self.History_Labels = History_Labels
        # -- Variable Declaration
        self.History, self.CUE = ['', '', '', '', '', '', '', ''], None
Esempio n. 5
0
    def EC_Control(self, targets):
        'Control of the EC menu'

        # (1) Updating the current selected button
        self.selected_icon = self.current_icons.pop(0)
        self.current_icons.append(self.selected_icon)
        # (2) Subutton labels modification
        ## -- current sub~label
        self.submenu_labels[self.selected_subutton].modify_font(
            pango.FontDescription(medium_font))
        ## -- next sublabel pre-deselection
        self.submenu_labels[self.current_subuttons[0]].modify_font(
            pango.FontDescription(medium_font))
        if self.selected_icon < 2:
            ## a.- Cue-Driven Systems
            if targets[-1] == self.selected_icon:
                for index in range(8):
                    ## -- original label
                    label = MainMenu[self.selected_icon][index]
                    ## -- underline~process for Cue-Driven systems
                    if any([target == index for target in targets[:-1]]):
                        # label creation
                        labels = label.split('\n')
                        for i in range(len(labels)):
                            labels[i] = labels[i].replace('', '_')[:-1]
                        label = '\n'.join(labels)
                        # re-design of the subutton
                        self.table.remove(self.submenu_buttons[index])
                        Button, Label = Button_Label(label, blue, 'white',
                                                     medium_font)
                        Label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
                        self.table.attach(Button, index, index + 1, 6, 8)
                        # button & label re-assignment
                        self.submenu_buttons[index], self.submenu_labels[
                            index] = Button, Label
                    ## -- submenu-labelling
                    else:
                        self.submenu_labels[index].set_label(label)
            ## b.- Systems different to Cue-Driven systems
            else:
                for index in range(8):
                    self.submenu_labels[index].set_label(
                        MainMenu[self.selected_icon][index])
        else:
            room = self.Current_Room.get_text()
            self.room_index = ROOMS.index(room)
            ## a.- Cue-Driven Systems
            if targets[-1] == self.selected_icon:
                for index in range(8):
                    ## -- original label
                    label = MainMenu[self.selected_icon][
                        self.room_index][index]
                    ## -- underline~process for Cue-Driven systems
                    if any([target == index for target in targets[:-1]]):
                        # label creation
                        labels = label.split('\n')
                        for i in range(len(labels)):
                            labels[i] = labels[i].replace('', '_')[:-1]
                        label = '\n'.join(labels)
                        # re-design of the subutton
                        self.table.remove(self.submenu_buttons[index])
                        Button, Label = Button_Label(label, blue, 'white',
                                                     medium_font)
                        Label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
                        self.table.attach(Button, index, index + 1, 6, 8)
                        # button & label re-assignment
                        self.submenu_buttons[index], self.submenu_labels[
                            index] = Button, Label
                    ## -- submenu-labelling
                    else:
                        self.submenu_labels[index].set_label(label)
            ## b.- Systems different to Cue-Driven systems
            else:
                for index in range(8):
                    self.submenu_labels[index].set_label(
                        MainMenu[self.selected_icon][self.room_index][index])
        # (3) Selection and deselection in main menu
        ## -- current icon label selection
        self.mainmenu_labels[self.selected_icon].modify_fg(
            gtk.STATE_NORMAL, gtk.gdk.color_parse(blue))
        self.mainmenu_labels[self.selected_icon].modify_font(
            pango.FontDescription(medium_font))
        ## -- last icon label deselection
        self.mainmenu_labels[self.current_icons[6]].modify_fg(
            gtk.STATE_NORMAL, gtk.gdk.color_parse('black'))
        self.mainmenu_labels[self.current_icons[6]].modify_font(
            pango.FontDescription(medium_font))
        ## -- last event_box background deselection
        STYLE = self.mainmenu_events[self.current_icons[6]].get_style().copy()
        STYLE.bg[gtk.STATE_NORMAL] = \
        self.mainmenu_events[self.current_icons[6]].get_colormap().alloc_color(ground)
        self.mainmenu_events[self.current_icons[6]].set_style(STYLE)
        ## -- current event_box background selection
        STYLE = self.mainmenu_events[self.selected_icon].get_style().copy()
        STYLE.bg[gtk.STATE_NORMAL] = self.mainmenu_events[
            self.selected_icon].get_colormap().alloc_color(blue)
        self.mainmenu_events[self.selected_icon].set_style(STYLE)
        ## -- different icons from 'Home'
        if self.selected_icon != 0:
            ## a.- commands belong to main menu
            return False
        else:
            ## b.- commands could belong to general menu
            return True
    def __init__(self):        
        'Initial method to generate the "Mobility" menu'
        
        # =============Mobility tab creation===============        
        # (1) TABLE: Widget container
        ## --9 x 8 table creation
        self.table = gtk.Table(9, 8, True)
        self.table.show()
        
        # (2) LABEL: Window title
        titulo = Label('Mobility', 'Neuropol 31', orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        self.table.attach(titulo, 6, 8, 0, 2)
        
        # (3) FRAMES & IMAGES: General menu images
        GralIconsON = []
        ## --'Necessities and Desires' option
        url = 'Images\\Necessity&Desire\\SNecessities_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[0], 2, 3, 0, 2)
        ## --'Mobility' option
        url = 'Images\\Mobility\\LMobility_on.png'
        mob_event, mob_image = Event_Image(url, ground)
        mob_event.set_border_width(10)
        GralIconsON.append(mob_image)
        self.table.attach(mob_event, 3, 4, 0, 2)
        ## --'Environmental Control' option
        url = 'Images\\EnvControl\\SHomeControl_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[2], 4, 5, 0, 2)
        ## --'Messenger' option
        url = 'Images\\Messenger\\SChat_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[3], 5, 6, 0, 2)
        
        # (4) IMAGES: Icons for cue indication
        CueSignals = []
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\left.png'
        image = Image(url)
        CueSignals.append(image)        
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\right.png'
        image = Image(url)
        CueSignals.append(image) 
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\idle.png'
        image = Image(url)
        CueSignals.append(image)  

        # (5) EVENTS & IMAGES: Room Selection
        mainmenu_icons, mainmenu_imagesOFF = [], []
        # --- exit
        eventbox, image = Event_Image('Images\\Mobility\\Exit_off.png', ground)
        eventbox.set_size_request(95, 95)
        self.table.attach(eventbox, 0, 1, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)        
        # --- caregiver's room
        eventbox, image = Event_Image('Images\\Mobility\\BedRoom2_off.png', ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 1, 3, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)        
        # --- bathroom
        eventbox, image = Event_Image('Images\\Mobility\\BathRoom_off.png', ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 3, 5, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)        
        # ---my bedroom
        eventbox, image = Event_Image('Images\\Mobility\\BedRoom1_off.png', ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 5, 7, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)     
        # --- exit
        eventbox, image = Event_Image('Images\\Mobility\\Exit_off.png', ground)
        eventbox.set_size_request(95, 95)
        self.table.attach(eventbox, 7, 8, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image) 
        # --- living room
        eventbox, image = Event_Image('Images\\Mobility\\LivingRoom_off.png', ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 1, 3, 5, 7)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)    
        # --- entrance
        eventbox, image = Event_Image('Images\\Mobility\\Entrance_off.png', ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 3, 5, 5, 7)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)   
        # --- kitchen
        eventbox, image = Event_Image('Images\\Mobility\\Kitchen_off.png', ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 5, 7, 5, 7)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)         
                
        # (6) LABELS: Icon labels for main menu
        mainmenu_labels = []
        # --- exit
        label = Label('Exit', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        label.set_size_request(95, 20)
        self.table.attach(label, 0, 1, 2, 3)
        mainmenu_labels.append(label)          
        # --- caregiver's room
        label = Label('Carer-Room', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        self.table.attach(label, 1, 3, 2, 3)
        mainmenu_labels.append(label)          
        # --- bathroom
        label = Label('Bathroom', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        self.table.attach(label, 3, 5, 2, 3)
        mainmenu_labels.append(label)       
        # ---my bedroom
        label = Label('My Bedroom', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)        
        self.table.attach(label, 5, 7, 2, 3)
        # --- exit        
        label = Label('Exit', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        eventbox.set_size_request(95, 20)
        mainmenu_labels.append(label)
        self.table.attach(label, 7, 8, 2, 3)        
        # --- living room
        label = Label('Living-Room', medium_font, lblue, 0.5, 0.2, gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)        
        self.table.attach(label, 1, 3, 7, 8)    
        # --- entrance
        label = Label('Entrance', medium_font, lblue, 0.5, 0.2, gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)        
        self.table.attach(label, 3, 5, 7, 8)
        # --- kitchen
        label = Label('Kitchen', medium_font, lblue, 0.5, 0.2, gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)        
        self.table.attach(label, 5, 7, 7, 8)
        
        
        # (7) IMAGES: general menu images for OFF state
        GralIconsOFF = []
        GralIconsOFF.append(Image('Images\\Necessity&Desire\\SNecessities_off.png'))
        GralIconsOFF.append(Image('Images\\Mobility\\LMobility_off.png'))
        GralIconsOFF.append(Image('Images\\EnvControl\\SHomeControl_off.png'))
        GralIconsOFF.append(Image('Images\\Messenger\\SChat_off.png'))         
        
        # (8) IMAGES: main menu images for ON state
        mainmenu_imagesON = []
        mainmenu_imagesON.append(Image('Images\\Mobility\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\BedRoom2_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\BathRoom_on.png'))        
        mainmenu_imagesON.append(Image('Images\\Mobility\\BedRoom1_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\LivingRoom_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\Entrance_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\Kitchen_on.png'))
        mainmenu_selection = []
        mainmenu_selection.append(Image('Images\\Mobility\\Exit.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\BedRoom2.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\BathRoom.png'))        
        mainmenu_selection.append(Image('Images\\Mobility\\BedRoom1.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\Exit.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\LivingRoom.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\Entrance.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\Kitchen.png'))         
        
        # (9) IMAGE: general menu image for MI state
        self.mob_MI = Image('Images\\Mobility\\LMobility_MI.png')         
        
        # (10) FRAME & LABELS: history of the selected tasks
        frame, label = Frame_Label('HISTORY - Recently Selected Places', ground, lblue, small_font, 0, 0.5, gtk.JUSTIFY_CENTER)
        self.table.attach(frame, 0, 8, 8, 9)
        History_Labels = []
        History_Labels.append(Label('', small_font, 'black', 0.1, 0.6, gtk.JUSTIFY_LEFT))
        self.table.attach(History_Labels[0], 0, 1, 8, 9)
        for index in range(1,8):
            History_Labels.append(Label('', small_font, lblue, 0.1, 0.6, gtk.JUSTIFY_LEFT))
            self.table.attach(History_Labels[index], index, index+1, 8, 9)      
 
        #(11) Widgets assignation to enable them in following
        #     methods
        ## -- ContainerS      
        self.mainmenu_icons = mainmenu_icons
        self.mob_event = mob_event
        ## -- ImageS
        self.CueSignals = CueSignals
        self.GralIconsON  = GralIconsON
        self.GralIconsOFF = GralIconsOFF
        self.mainmenu_imagesON  = mainmenu_imagesON
        self.mainmenu_imagesOFF = mainmenu_imagesOFF
        self.mainmenu_selection = mainmenu_selection
        ## -- LabelS
        self.mainmenu_labels = mainmenu_labels
        self.titulo = titulo
        self.History_Labels = History_Labels
        ## -- Variable Declaration
        self.History, self.CUE = ['','','','','','','',''], None
Esempio n. 7
0
    def __init__(self):
        'Initial method to generate the "Mobility" menu'

        # =============Mobility tab creation===============
        # (1) TABLE: Widget container
        ## --9 x 8 table creation
        self.table = gtk.Table(9, 8, True)
        self.table.show()

        # (2) LABEL: Window title
        titulo = Label('Mobility', 'Neuropol 31', orange, 0.5, 0.5,
                       gtk.JUSTIFY_CENTER)
        self.table.attach(titulo, 6, 8, 0, 2)

        # (3) FRAMES & IMAGES: General menu images
        GralIconsON = []
        ## --'Necessities and Desires' option
        url = 'Images\\Necessity&Desire\\SNecessities_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[0], 2, 3, 0, 2)
        ## --'Mobility' option
        url = 'Images\\Mobility\\LMobility_on.png'
        mob_event, mob_image = Event_Image(url, ground)
        mob_event.set_border_width(10)
        GralIconsON.append(mob_image)
        self.table.attach(mob_event, 3, 4, 0, 2)
        ## --'Environmental Control' option
        url = 'Images\\EnvControl\\SHomeControl_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[2], 4, 5, 0, 2)
        ## --'Messenger' option
        url = 'Images\\Messenger\\SChat_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[3], 5, 6, 0, 2)

        # (4) IMAGES: Icons for cue indication
        CueSignals = []
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\left.png'
        image = Image(url)
        CueSignals.append(image)
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\right.png'
        image = Image(url)
        CueSignals.append(image)
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\idle.png'
        image = Image(url)
        CueSignals.append(image)

        # (5) EVENTS & IMAGES: Room Selection
        mainmenu_icons, mainmenu_imagesOFF = [], []
        # --- exit
        eventbox, image = Event_Image('Images\\Mobility\\Exit_off.png', ground)
        eventbox.set_size_request(95, 95)
        self.table.attach(eventbox, 0, 1, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # --- caregiver's room
        eventbox, image = Event_Image('Images\\Mobility\\BedRoom2_off.png',
                                      ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 1, 3, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # --- bathroom
        eventbox, image = Event_Image('Images\\Mobility\\BathRoom_off.png',
                                      ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 3, 5, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # ---my bedroom
        eventbox, image = Event_Image('Images\\Mobility\\BedRoom1_off.png',
                                      ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 5, 7, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # --- exit
        eventbox, image = Event_Image('Images\\Mobility\\Exit_off.png', ground)
        eventbox.set_size_request(95, 95)
        self.table.attach(eventbox, 7, 8, 3, 5)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # --- living room
        eventbox, image = Event_Image('Images\\Mobility\\LivingRoom_off.png',
                                      ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 1, 3, 5, 7)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # --- entrance
        eventbox, image = Event_Image('Images\\Mobility\\Entrance_off.png',
                                      ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 3, 5, 5, 7)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)
        # --- kitchen
        eventbox, image = Event_Image('Images\\Mobility\\Kitchen_off.png',
                                      ground)
        eventbox.set_size_request(250, 95)
        self.table.attach(eventbox, 5, 7, 5, 7)
        mainmenu_icons.append(eventbox)
        mainmenu_imagesOFF.append(image)

        # (6) LABELS: Icon labels for main menu
        mainmenu_labels = []
        # --- exit
        label = Label('Exit', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        label.set_size_request(95, 20)
        self.table.attach(label, 0, 1, 2, 3)
        mainmenu_labels.append(label)
        # --- caregiver's room
        label = Label('Carer-Room', medium_font, lblue, 0.5, 0.8,
                      gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        self.table.attach(label, 1, 3, 2, 3)
        mainmenu_labels.append(label)
        # --- bathroom
        label = Label('Bathroom', medium_font, lblue, 0.5, 0.8,
                      gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        self.table.attach(label, 3, 5, 2, 3)
        mainmenu_labels.append(label)
        # ---my bedroom
        label = Label('My Bedroom', medium_font, lblue, 0.5, 0.8,
                      gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)
        self.table.attach(label, 5, 7, 2, 3)
        # --- exit
        label = Label('Exit', medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
        eventbox.set_size_request(95, 20)
        mainmenu_labels.append(label)
        self.table.attach(label, 7, 8, 2, 3)
        # --- living room
        label = Label('Living-Room', medium_font, lblue, 0.5, 0.2,
                      gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)
        self.table.attach(label, 1, 3, 7, 8)
        # --- entrance
        label = Label('Entrance', medium_font, lblue, 0.5, 0.2,
                      gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)
        self.table.attach(label, 3, 5, 7, 8)
        # --- kitchen
        label = Label('Kitchen', medium_font, lblue, 0.5, 0.2,
                      gtk.JUSTIFY_CENTER)
        label.set_size_request(250, 20)
        mainmenu_labels.append(label)
        self.table.attach(label, 5, 7, 7, 8)

        # (7) IMAGES: general menu images for OFF state
        GralIconsOFF = []
        GralIconsOFF.append(
            Image('Images\\Necessity&Desire\\SNecessities_off.png'))
        GralIconsOFF.append(Image('Images\\Mobility\\LMobility_off.png'))
        GralIconsOFF.append(Image('Images\\EnvControl\\SHomeControl_off.png'))
        GralIconsOFF.append(Image('Images\\Messenger\\SChat_off.png'))

        # (8) IMAGES: main menu images for ON state
        mainmenu_imagesON = []
        mainmenu_imagesON.append(Image('Images\\Mobility\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\BedRoom2_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\BathRoom_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\BedRoom1_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\LivingRoom_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\Entrance_on.png'))
        mainmenu_imagesON.append(Image('Images\\Mobility\\Kitchen_on.png'))
        mainmenu_selection = []
        mainmenu_selection.append(Image('Images\\Mobility\\Exit.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\BedRoom2.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\BathRoom.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\BedRoom1.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\Exit.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\LivingRoom.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\Entrance.png'))
        mainmenu_selection.append(Image('Images\\Mobility\\Kitchen.png'))

        # (9) IMAGE: general menu image for MI state
        self.mob_MI = Image('Images\\Mobility\\LMobility_MI.png')

        # (10) FRAME & LABELS: history of the selected tasks
        frame, label = Frame_Label('HISTORY - Recently Selected Places',
                                   ground, lblue, small_font, 0, 0.5,
                                   gtk.JUSTIFY_CENTER)
        self.table.attach(frame, 0, 8, 8, 9)
        History_Labels = []
        History_Labels.append(
            Label('', small_font, 'black', 0.1, 0.6, gtk.JUSTIFY_LEFT))
        self.table.attach(History_Labels[0], 0, 1, 8, 9)
        for index in range(1, 8):
            History_Labels.append(
                Label('', small_font, lblue, 0.1, 0.6, gtk.JUSTIFY_LEFT))
            self.table.attach(History_Labels[index], index, index + 1, 8, 9)

        #(11) Widgets assignation to enable them in following
        #     methods
        ## -- ContainerS
        self.mainmenu_icons = mainmenu_icons
        self.mob_event = mob_event
        ## -- ImageS
        self.CueSignals = CueSignals
        self.GralIconsON = GralIconsON
        self.GralIconsOFF = GralIconsOFF
        self.mainmenu_imagesON = mainmenu_imagesON
        self.mainmenu_imagesOFF = mainmenu_imagesOFF
        self.mainmenu_selection = mainmenu_selection
        ## -- LabelS
        self.mainmenu_labels = mainmenu_labels
        self.titulo = titulo
        self.History_Labels = History_Labels
        ## -- Variable Declaration
        self.History, self.CUE = ['', '', '', '', '', '', '', ''], None
Esempio n. 8
0
    def __init__(self):        
        'Initial method to generate the "User-Tutorial" menu'
        
        # ============User-Tutorial tab creation==============        
        # (1) TABLE: Widget container
        ## --9 x 8 table creation
        self.table = gtk.Table(9, 8, False)
        self.table.show()
        
        # (2) LABEL: Window title
        titulo = Label('Menu 1', 'Neuropol 33', orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)        
        titulo.hide()
        self.table.attach(titulo, 6, 8, 0, 2) 

        # (3) IMAGES: Icons for cue indication (Tutorial_MI mode)
        CueSignals = [[],[]]
        # -- cue: MI preparation
        url = 'Images\\User_Tutorial\\cue_warning.png'
        image = Image(url)        
        CueSignals[0].append(image)        
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\cue_left.png'
        image = Image(url)
        CueSignals[0].append(image)        
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\cue_right.png'
        image = Image(url)
        CueSignals[0].append(image) 
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\cue_idle.png'
        image = Image(url)
        CueSignals[0].append(image)      
        
        # (4) IMAGES: Icons for cue indication (Tutorial_CMD mode)     
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\left.png'
        image = Image(url)
        CueSignals[1].append(image)        
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\right.png'
        image = Image(url)
        CueSignals[1].append(image) 
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\idle.png'
        image = Image(url)
        CueSignals[1].append(image)             
        
        # (5) IMAGES: General menu images
        MiniIconsON, GralEvents = [], []
        for index in range(2,6):
            url = 'Images\\User_Tutorial\\minimenu_on.png'
            event, image = Event_Image(url, ground)
            event.hide()
            MiniIconsON.append(image)
            GralEvents.append(event)
            self.table.attach(event, index, index+1, 0, 2)  
        
        # (6) LABELS: main menu labels
        mainmenu_labels, x, y = [], 0, 1
        Mnum = 'TAB  1'.split()[-1]
        for item in MainMenu:
            if item.lower() != 'exit':
                rename= item.split(' ')
                rename= [rename[0], '\n', Mnum, '.', rename[-1]]
                item  = ''.join(rename)
            label = Label(item, medium_font, lblue, 0.5, 0.9, gtk.JUSTIFY_CENTER)
            label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
            label.hide()
            mainmenu_labels.append(label) 
            self.table.attach(label, x, y, 2, 4)
            x += 1
            y += 1       
                        
        # (7) IMAGES: main menu images
        mainmenu_events, mainmenu_imagesOFF = [], []
        for index in range(7):
            url = 'Images\\User_Tutorial\\option_off.png'
            event, image = Event_Image(url, ground)
            event.hide()
            mainmenu_events.append(event)
            mainmenu_imagesOFF.append(image)
            self.table.attach(event, index, index+1, 4, 6)
        url = 'Images\\User_Tutorial\\Exit_off.png'
        event, image = Event_Image(url, ground)
        event.hide()
        mainmenu_events.append(event)
        mainmenu_imagesOFF.append(image)
        self.table.attach(event, 7, 8, 4, 6)

        # (8) BUTTONS: list of tasks
        submenu_labels, submenu_buttons= [], []
        for x in range(0,8):
            button, label = Button_Label('', lblue, 'white', medium_font)
            label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
            button.hide()
            self.table.attach(button, x, x+1, 6, 8)
            submenu_labels.append(label)
            submenu_buttons.append(button)       
        
        # (9) IMAGES: menu images for OFF or ON states
        MiniIconsOFF, GralIconsON, GralIconsOFF, mainmenu_imagesON, submenu_imagesON = [], [], [], [], []
        for index in range(4):
            MiniIconsOFF.append(Image('Images\\User_Tutorial\\minimenu_off.png')) 
            GralIconsON.append(Image('Images\\User_Tutorial\\menu_on.png')) 
            GralIconsOFF.append(Image('Images\\User_Tutorial\\menu_off.png'))                 
        for index in range(7): mainmenu_imagesON.append(Image('Images\\User_Tutorial\\option_on.png'))
        mainmenu_imagesON.append(Image('Images\\User_Tutorial\\Exit_on.png'))
        for index in range(8): submenu_imagesON.append(Image('Images\\User_Tutorial\\task_on.png'))
               
        # (10) FRAME & LABELS: history of the selected tasks
        self.History_Frame, label = Frame_Label('HISTORY - Recently Selected Tasks', ground, lblue, small_font, 0, 0.5, gtk.JUSTIFY_CENTER)
        self.History_Frame.hide()
        self.table.attach(self.History_Frame, 0, 8, 8, 9)
        History_Labels = []
        History_Labels.append(Label('', small_font, 'black', 0.1, 0.7, gtk.JUSTIFY_LEFT))
        self.table.attach(History_Labels[0], 0, 1, 8, 9)
        for index in range(1,8):
            History_Labels.append(Label('', small_font, lblue, 0.1, 0.7, gtk.JUSTIFY_LEFT))
            self.table.attach(History_Labels[index], index, index+1, 8, 9) 
        for widget in History_Labels: widget.hide()
        
        #(11)Widgets assignation to enable them in the following
        #    methods        
        # -- ImageS
        self.CueSignals = CueSignals
        self.MiniIconsON = MiniIconsON
        self.MiniIconsOFF = MiniIconsOFF 
        self.GralIconsON = GralIconsON
        self.GralIconsOFF = GralIconsOFF
        self.mainmenu_imagesOFF = mainmenu_imagesOFF
        self.mainmenu_imagesON  = mainmenu_imagesON        
        # -- Events        
        self.GralEvents = GralEvents
        self.mainmenu_events = mainmenu_events
        # -- Labels
        self.mainmenu_labels= mainmenu_labels
        self.submenu_labels = submenu_labels
        self.History_Labels = History_Labels
        self.titulo = titulo
        # -- ButtonS
        self.submenu_buttons = submenu_buttons    
        # -- Variable Declaration
        self.History = ['','','','','','','','']   
Esempio n. 9
0
    def __init__(self):
        'Initial method to generate the Essex HCI'

        # ==================thread creation=================
        threading.Thread.__init__(self)
        
        # ================interface creation================        
        # (1) WINDOW 
        ## -- window creation
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        ## --window configuration
        self.window.set_title("ESSEX Virtual Environment: Human-Computer Interface")
        background = gtk.gdk.color_parse(ground)
        self.window.modify_bg(gtk.STATE_NORMAL, background)
        self.window.set_border_width(7)
        self.window.set_resizable(True)
        self.window.resize(1275, 770)
        self.window.move(-1, -2)
        ## -- window events connection
        self.window.connect('destroy', self.destroy)
        
        # (2) TABLE: General widget container
        table = gtk.Table(3, 4, False)
        table.show()
        self.window.add(table)
        
        # (3) NOTEBOOK: General widget container
        ## -- notebook creation
        general_menu = gtk.Notebook()
        ## -- notebook configuration
        general_menu.set_show_border(True)
        general_menu.set_show_tabs(True)     
        general_menu.set_size_request(1260, 705)   
        style = general_menu.get_style().copy()
        style.bg[gtk.STATE_NORMAL] = general_menu.get_colormap().alloc_color(tab_bg)
        general_menu.set_style(style)
        ## -- 'necessities & desires' tab insertion
        nd_label = Label('Necessities&Desires ', small_font, orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        necessities = nd_menu()
        nd_table = necessities.nd_container()
        general_menu.append_page(nd_table, nd_label)        
        ## -- 'mobility' tab insertion
        mob_label = Label('Mobility ', small_font, orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        mobility = mob_menu()
        mob_table = mobility.mob_container()
        general_menu.append_page(mob_table, mob_label)        
        ## -- 'environment control' (EC) tab insertion
        EC_label = Label('EnvironmentControl ', small_font, orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        EC = EC_menu()
        EC_table = EC.EC_container()
        general_menu.append_page(EC_table, EC_label)        
        ## -- 'messenger' tab insertion
        msg_label = Label('Messenger ', small_font, orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        messenger = msg_menu()
        msg_table = messenger.msg_container()
        general_menu.append_page(msg_table, msg_label)
        ## -- 'user-training' tab insertion
        ut_label = Label('User-Training ', small_font, orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)
        tutorial = UT_menu()
        ut_table = tutorial.UT_container()
        general_menu.append_page(ut_table, ut_label)
        ## -- notebook insertion to table
        table.attach(general_menu, 0, 4, 0, 1)
        general_menu.show()
        self.window.show()
        
        # (4) Copyright
        label = Label(' University of Essex ~ BCI Group', small_font, lblue, 0, 1, gtk.JUSTIFY_LEFT)
        table.attach(label, 0, 1, 1, 2)
        label = Label(' Luz Ma. Alonso Valerdi & Francisco Sepulveda', small_font, lblue, 0, 0.5, gtk.JUSTIFY_LEFT)
        table.attach(label, 0, 1, 2, 3)  
        border = Image('Images\\Border.png')
        border.set_alignment(xalign = 0.3, yalign = 0.75)
        table.attach(border, 1, 3, 1, 3) 
        logo = Image('Images\\logo.jpg')
        logo.set_alignment(xalign = 0.95, yalign = 1)
        table.attach(logo, 3, 4, 1, 3)
        general_menu.set_current_page(-1)             
                
        # (5) Attribute assignation to enable them in following
        #     methods
        ## -- main window
        self.general_menu = general_menu
        ## -- each instance corresponding to each tab        
        self.necessities = necessities
        self.mobility = mobility
        self.EC = EC
        self.messenger = messenger
        self.tutorial = tutorial
        ## -- each widget container (table) corresponding to each tab
        self.TabTables = (nd_table, mob_table, EC_table, msg_table)
        self.quit = False
Esempio n. 10
0
    def __init__(self):        
        'Initial method to generate the "Necessities & Desires" menu'
        
        # =======Necessities & Desires tab creation=========        
        # (1) TABLE: Widget container
        ## --9 x 8 table creation
        self.table = gtk.Table(9, 8, True)
        self.table.show()

        # (2) LABEL: Window title
        titulo = Label('Necessities\n & Desires', 'Neuropol 31', orange, 0.5, 0.5, gtk.JUSTIFY_CENTER)        
        self.table.attach(titulo, 6, 8, 0, 2)        

        # (3) FRAMES & IMAGES: General menu images
        GralIconsON = []
        ## --'Necessities and Desires' option
        url = 'Images\\Necessity&Desire\\LNecessities_on.png'
        nd_event, nd_image = Event_Image(url, ground)
        nd_event.set_border_width(10)
        GralIconsON.append(nd_image)
        self.table.attach(nd_event, 2, 3, 0, 2)
        ## --'Mobility' option
        url = 'Images\\Mobility\\SMobility_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[1], 3, 4, 0, 2)
        ## --'Environmental Control' option
        url = 'Images\\EnvControl\\SHomeControl_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[2], 4, 5, 0, 2)
        ## --'Messenger' option
        url = 'Images\\Messenger\\SChat_on.png'
        GralIconsON.append(Image(url))
        self.table.attach(GralIconsON[3], 5, 6, 0, 2)
        
        # (4) IMAGES: Icons for cue indication
        CueSignals = []
        # -- cue: Left MI performance
        url = 'Images\\User_Tutorial\\left.png'
        image = Image(url)
        CueSignals.append(image)        
        # -- cue: Right MI performance
        url = 'Images\\User_Tutorial\\right.png'
        image = Image(url)
        CueSignals.append(image) 
        # -- cue: Idle MI performance
        url = 'Images\\User_Tutorial\\idle.png'
        image = Image(url)
        CueSignals.append(image)          
        
        # (5) LABELS: Icon labels for main menu
        # -- variable declaration
        mainmenu_labels, x, y = [], 0, 3
        Main_Menu = ['Exit','Cleanness','Personal\nCare','Toilet\nSupport',\
                     'Exit','Dressing\nfor...','Food\nProvision','Body\nPostures']
        # -- first item
        label = Label(Main_Menu[0], medium_font, lblue, 0.1, 0.8, gtk.JUSTIFY_LEFT)
        self.table.attach(label, 0, 2, 2, 4)
        mainmenu_labels.append(label)           
        # -- internal items
        for menu in Main_Menu[1:-1]:
            label = Label(menu, medium_font, lblue, 0.5, 0.8, gtk.JUSTIFY_CENTER)
            self.table.attach(label, x, y, 2, 4)
            mainmenu_labels.append(label) 
            x += 1
            y += 1               
        # -- last item
        label = Label(Main_Menu[-1], medium_font, lblue, 0.9, 0.8, gtk.JUSTIFY_RIGHT)
        self.table.attach(label, 6, 8, 2, 4)
        mainmenu_labels.append(label)    

        # (6) EVENTS & IMAGES: main menu images
        mainmenu_events, mainmenu_imagesOFF, x, y = [], [], 0, 1
        URLs = ['Images\\Necessity&Desire\\Exit_off.png',\
                'Images\\Necessity&Desire\\Cleanness_off.png',\
                'Images\\Necessity&Desire\\PersonalCare_off.png',\
                'Images\\Necessity&Desire\\ToiletHelp_off.png',\
                'Images\\Necessity&Desire\\Exit_off.png',\
                'Images\\Necessity&Desire\\Dressing_off.png',\
                'Images\\Necessity&Desire\\FoodProvision_off.png',\
                'Images\\Necessity&Desire\\BodyPostures_off.png']
        for url in URLs:
            eventbox, image = Event_Image(url, ground)
            self.table.attach(eventbox, x, y, 4, 6)
            mainmenu_events.append(eventbox)
            mainmenu_imagesOFF.append(image)
            x += 1
            y += 1 

        # (7) BUTTONS: list of necessities and desires
        submenu_labels, submenu_buttons= [], []
        for x in range(0,8):
            button, label = Button_Label('', lblue, 'white', medium_font)
            label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
            self.table.attach(button, x, x+1, 6, 8)
            submenu_labels.append(label)
            submenu_buttons.append(button)       
        
        # (8) IMAGES: general menu images for OFF state
        GralIconsOFF = []
        GralIconsOFF.append(Image('Images\\Necessity&Desire\\LNecessities_off.png')) 
        GralIconsOFF.append(Image('Images\\Mobility\\SMobility_off.png'))
        GralIconsOFF.append(Image('Images\\EnvControl\\SHomeControl_off.png'))
        GralIconsOFF.append(Image('Images\\Messenger\\SChat_off.png'))         
        
        # (9) IMAGES: main menu images for ON state
        mainmenu_imagesON = [] 
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\Cleanness_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\PersonalCare_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\ToiletHelp_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\Exit_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\Dressing_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\FoodProvision_on.png'))
        mainmenu_imagesON.append(Image('Images\\Necessity&Desire\\BodyPostures_on.png'))   
        
        # (10) FRAME & LABELS: history of the selected tasks
        frame, label = Frame_Label(' HISTORY  -  Recently Selected Tasks ', ground, lblue, small_font, 0, 0.5, gtk.JUSTIFY_CENTER)
        self.table.attach(frame, 0, 8, 8, 9)
        History_Labels = []
        History_Labels.append(Label('', small_font, 'black', 0.1, 0.9, gtk.JUSTIFY_LEFT))
        self.table.attach(History_Labels[0], 0, 1, 8, 9)
        for index in range(1,8):
            History_Labels.append(Label('', small_font, lblue, 0.1, 0.9, gtk.JUSTIFY_LEFT))
            self.table.attach(History_Labels[index], index, index+1, 8, 9) 
        
        #(11) Widgets assignation to enable them in the following
        #     methods
        # -- ButtonS
        self.submenu_buttons = submenu_buttons
        # -- ImageS
        self.CueSignals = CueSignals
        self.GralIconsON  = GralIconsON
        self.GralIconsOFF = GralIconsOFF
        self.mainmenu_imagesOFF = mainmenu_imagesOFF
        self.mainmenu_imagesON  = mainmenu_imagesON
        # -- Events        
        self.mainmenu_events = mainmenu_events
        # -- FrameS
        self.nd_event = nd_event
        # -- LabelS
        self.titulo = titulo
        self.mainmenu_labels = mainmenu_labels        
        self.submenu_labels = submenu_labels
        self.History_Labels = History_Labels
        # -- Variable Declaration
        self.History, self.CUE = ['','','','','','','',''], None