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 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 DialogBox(device, target): 'Instructions to listen the Audio-Targets in Target-Driven Systems' ## -- dialog box window = gtk.Window(gtk.WINDOW_TOPLEVEL) ## --window configuration window.set_title("ESSEX Virtual Environment: Human-Computer Interface") background = gtk.gdk.color_parse(tab_bg) window.modify_bg(gtk.STATE_NORMAL, background) window.set_border_width(10) ## -- table: General widget container table = gtk.Table(1, 2, True) table.show() ## -- widget packing window.add(table) # label widget message = Label('hello', 'Elephant 20', 'orange', 0, 0.5, gtk.JUSTIFY_LEFT) table.attach(message, 1, 2, 0, 1) cartoon = Image('Images\\GetReady.png') table.attach(cartoon, 0, 1, 0, 1) ## -- dialog display window.show_all() window.connect('destroy', destroy)
def __init__(self): 'Initial method to generate the "Messenger" menu' # =============Messenger 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('Messenger', '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\\SHomeControl_on.png' GralIconsON.append(Image(url)) self.table.attach(GralIconsON[2], 4, 5, 0, 2) ## --'Messenger' option url = 'Images\\Messenger\\LChat_on.png' msg_event, msg_image = Event_Image(url, ground) msg_event.set_border_width(10) GralIconsON.append(msg_image) self.table.attach(msg_event, 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) TEXT ENTRY ## -- text entry entry = gtk.Entry(False) entry.modify_font(pango.FontDescription(small_font)) entry.show() self.table.attach(entry, 1, 8, 2, 3) ## -- text- image url = 'Images\\Messenger\\Text_off.png' writeOFF = Image(url) self.table.attach(writeOFF, 0, 1, 2, 3) # (6) BUTTONS: Messenger main menu mainmenu_labels, mainmenu_buttons = [], [] labels = ['a b c d e', 'f g h i j', 'k l m n o',\ 'p q r s t', 'uv wx yz', 'Options', 'Emotions', 'E X I T'] for index in range(8): button, label = Button_Label(labels[index], lblue, lblue, medium_font) label.set_ellipsize(pango.ELLIPSIZE_MIDDLE) self.table.attach(button, index, index+1, 3, 4) mainmenu_labels.append(label) mainmenu_buttons.append(button) # (7) BUTTONS: Messenger sub - menu submenu_buttons, submenu_labels = [], [] for x in range(8): subutton, sublabel = Button_Label('', lblue, 'white', medium_font) sublabel.set_ellipsize(pango.ELLIPSIZE_MIDDLE) self.table.attach(subutton, x, x+1, 4, 5) submenu_buttons.append(subutton) submenu_labels.append(sublabel) # (8) TEXT DISPLAY frame_win, textview, textbuffer, tagB, tagG = Window_TextView(medium_font, blue) self.table.attach(frame_win, 0, 8, 5, 8) # (9) FRAME & LABEL: Available options ## --frame creation frame, label = Frame_Label('AVAILABLE OPTIONS', ground, lblue, small_font, 0, 0.5, gtk.JUSTIFY_CENTER) self.table.attach(frame, 0, 8, 8, 9) ## --menu of options options_menu = [] for index in range(8): option = Label('', medium_font, 'black', 0.5, 0.5, gtk.JUSTIFY_CENTER) self.table.attach(option, index, index+1, 8, 9) options_menu.append(option) # (10) IMAGES: general menu images GralIconsOFF = [] GralIconsOFF.append(Image('Images\\Necessity&Desire\\SNecessities_off.png')) GralIconsOFF.append(Image('Images\\Mobility\\SMobility_off.png')) GralIconsOFF.append(Image('Images\\EnvControl\\SHomeControl_off.png')) GralIconsOFF.append(Image('Images\\Messenger\\LChat_off.png')) writeON = Image('Images\\Messenger\\Text_on.png') self.msg_MI = Image('Images\\Messenger\\LChat_MI.png') #(11) IMAGES: emotion submenu SelectedEmotion = [] SelectedEmotion.append(Image('Images\\Messenger\\joy_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\sadness_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\trust_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\disgust_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\fear_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\anger_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\surprise_selection.png')) SelectedEmotion.append(Image('Images\\Messenger\\anticipation_selection.png')) #(12) Widgets assignation to enable them in the following # methods ## -- ButtonS self.mainmenu_buttons = mainmenu_buttons self.submenu_buttons = submenu_buttons ## -- ImageS self.msg_image = msg_image self.writeOFF = writeOFF self.writeON = writeON self.GralIconsOFF = GralIconsOFF self.GralIconsON = GralIconsON self.SelectedEmotion = SelectedEmotion ## -- FrameS self.msg_event = msg_event self.frame_win = frame_win ## -- LabelS self.CueSignals = CueSignals self.titulo = titulo self.mainmenu_labels = mainmenu_labels self.submenu_labels = submenu_labels self.options_menu = options_menu ## -- TextEntrY self.entry = entry ## -- TextDiplaY self.textview = textview self.textbuffer = textbuffer self.tagB, self.tagG = tagB, tagG ## -- Variable Declaration self.CUE = None # Messages variables self.text, self.OPTIONS, self.num_space = '', ['','','','','','','',''], 0
medium_font = "Century Gothic 17" small_font = "Century Gothic 10" # (2) Main menu dictionary (main buttons labels) MainMenu = {0: ['a','b','c','d','e','delete','space','send'], 1: ['f','g','h','i','j','delete','space','send'], 2: ['k','l','m','n','o','delete','space','send'], 3: ['p','q','r','s','t','delete','space','send'], 4: ['u','v','w','x','y','z','delete','space'], 5: ['','','','','','','',''], 6: ['Images\\Messenger\\joy.png','Images\\Messenger\\sadness.png','Images\\Messenger\\trust.png', 'Images\\Messenger\\disgust.png','Images\\Messenger\\fear.png','Images\\Messenger\\anger.png', 'Images\\Messenger\\surprise.png','Images\\Messenger\\anticipation.png'], 7: 'Exit'} # (3) List of emotions cartoon for index in range(8): MainMenu[6][index] = Image(MainMenu[6][index]) # |||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # FUNCTION DECLARATION # |||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # "msg_menu" CLASS DECLARATION class msg_menu(): 'Class to control the "Messenger" tab' #............Method 1: Initialization Process........... def __init__(self): 'Initial method to generate the "Messenger" menu'
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
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
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
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 = ['','','','','','','','']
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
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