Esempio n. 1
0
 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 __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. 3
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. 4
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. 5
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