class WinPlayerSelect(WahCade): """Window allowing the user to identify themself""" def __init__(self, WinMain): # Set main window self.WinMain = WinMain # Build the window self.winPlayers = gtk.Fixed() self.winPlayers.set_has_window(True) self.imgBackground = gtk.Image() self.lblScore = gtk.Label() self.lbl1 = gtk.Label() self.sclPlayers = ScrollList(self.WinMain) self.winPlayers.add(self.imgBackground) self.winPlayers.add(self.lblScore) self.winPlayers.add(self.lbl1) # self.winPlayers.add(self.lblRFID) self.winPlayers.add(self.sclPlayers.fixd) WinMain.fixd.add(self.winPlayers) self.imgBackground.show() self.lbl1.show() self.winPlayers.show() # Build list self.lsPlayers = self.WinMain.current_players self.sclPlayers.auto_update = True # Get keyboard & mouse events self.sclPlayers.connect('update', self.on_sclPlayers_changed) self.sclPlayers.connect('mouse-left-click', self.on_sclPlayers_changed) self.sclPlayers.connect('mouse-double-click', self.player_selected) # Set up IDs self.sclPlayers.ls = [l for l in self.lsPlayers] self.sclPlayers.ls.sort() # Init window self.lblScore.set_text("Who's score was this?") self.lbl1.set_text("-------------") self.record = False self.on_keypress = False def populate_list(self): self.sclPlayers.ls = [l for l in self.WinMain.current_players] self.sclPlayers.ls.sort() def on_sclPlayers_changed(self, *args): """Selected user identity changed""" # Update list widget self.sclPlayers._update_display() return def player_selected(self, *args): """ID selected""" return
class WinPopular(WahCade): """Window allowing user to select a popular game""" def __init__(self, WinMain): # Main parent window self.WinMain = WinMain # Internals self.winPop = gtk.Fixed() self.winPop.set_has_window(True) self.imgBackground = gtk.Image() self.lblHeading = gtk.Label() self.sclPop = ScrollList(self.WinMain) self.winPop.add(self.imgBackground) self.winPop.add(self.lblHeading) self.winPop.add(self.sclPop.fixd) WinMain.fixd.add(self.winPop) self.imgBackground.show() self.lblHeading.show() self.sclPop.show() # Get keyboard & mouse events self.sclPop.connect('update', self.on_sclPop_changed) self.sclPop.connect('mouse-left-click', self.on_sclPop_changed) self.sclPop.connect('mouse-double-click', self.Pop_selected) # Set up games list self.sclPop.auto_update = True self.lsPop = [ "Game", "Other Game", "Best Game", "#4", "#5", "#6", "#7", "#8", "#9", "#10" ] self.sclPop.ls = [g for g in self.lsPop] self.sclPop.ls.sort() self.sclPop._update_display() # Set text self.lblHeading.set_text("10 Most Popular Games") def on_sclPop_changed(self, *args): """List is scrolling somehow""" # Update the display self.sclPop._update_display() pass def get_selected_romname(self): return self.romPop[self.sclPop.get_selected()] def Pop_selected(self): print "Pop_selected" pass def set_games_list(self, games): self.lsPop = [g[0] for g in games] self.romPop = [g[1] for g in games] self.sclPop.ls = [g for g in self.lsPop] self.sclPop._update_display
class WinPopular(WahCade): """Window allowing user to select a popular game""" def __init__(self, WinMain): # Main parent window self.WinMain = WinMain # Internals self.winPop = gtk.Fixed() self.winPop.set_has_window(True) self.imgBackground = gtk.Image() self.lblHeading = gtk.Label() self.sclPop = ScrollList(self.WinMain) self.winPop.add(self.imgBackground) self.winPop.add(self.lblHeading) self.winPop.add(self.sclPop.fixd) WinMain.fixd.add(self.winPop) self.imgBackground.show() self.lblHeading.show() self.sclPop.show() # Get keyboard & mouse events self.sclPop.connect('update', self.on_sclPop_changed) self.sclPop.connect('mouse-left-click', self.on_sclPop_changed) self.sclPop.connect('mouse-double-click', self.Pop_selected) # Set up games list self.sclPop.auto_update = True self.lsPop = ["Game", "Other Game", "Best Game", "#4", "#5", "#6", "#7", "#8", "#9", "#10"] self.sclPop.ls = [g for g in self.lsPop] self.sclPop.ls.sort() self.sclPop._update_display() # Set text self.lblHeading.set_text("10 Most Popular Games") def on_sclPop_changed(self, *args): """List is scrolling somehow""" # Update the display self.sclPop._update_display() pass def get_selected_romname(self): return self.romPop[self.sclPop.get_selected()] def Pop_selected(self): print "Pop_selected" pass def set_games_list(self, games): self.lsPop = [g[0] for g in games] self.romPop = [g[1] for g in games] self.sclPop.ls = [g for g in self.lsPop] self.sclPop._update_display
class WinIdentify(WahCade): """Window allowing the user to identify themself""" def __init__(self, WinMain): # Set main window self.WinMain = WinMain # Build the window self.winID = gtk.Fixed() self.winID.set_has_window(True) self.imgBackground = gtk.Image() self.lblPrompt = gtk.Label() self.lblPromptText = gtk.Label() self.lblRFID = gtk.Label() self.sclIDs = ScrollList(self.WinMain) self.winID.add(self.imgBackground) self.winID.add(self.lblPrompt) self.winID.add(self.lblPromptText) self.winID.add(self.lblRFID) self.winID.add(self.sclIDs.fixd) WinMain.fixd.add(self.winID) self.imgBackground.show() self.lblPrompt.show() self.lblPromptText.show() self.winID.show() # Build list self.ldap = LoadLDAP() self.lsIDs = self.ldap.getNames() self.sclIDs.auto_update = True # Get keyboard & mouse events self.sclIDs.connect('update', self.on_sclIDs_changed) self.sclIDs.connect('mouse-left-click', self.on_sclIDs_changed) self.sclIDs.connect('mouse-double-click', self.ID_selected) # Init window self.set_lbls() self.record = False self.on_keypress = False def setRFIDlbl(self, value): """Sets RFID number""" self.lblRFID.set_text(value) def on_sclIDs_changed(self, *args): """Selected user identity changed""" # Update list widget self.sclIDs._update_display() #print self.sclIDs.ls[self.sclIDs.get_selected()] return def ID_selected(self, *args): """ID selected""" return def Setup_IDs_list(self, login_type='automatic'): """Generates the list of unregistered users""" if login_type == 'automatic': self.WinMain.player_info = self.WinMain.get_player_info() self.sclIDs.ls = [l for l in self.lsIDs] self.sclIDs.ls.sort() # Exclude IDs already matched to RFID values for v in self.WinMain.player_info: if v[1] != "1" and v[0] in self.sclIDs.ls: self.sclIDs.ls.remove(v[0]) elif login_type == 'manual': self.WinMain.player_info = self.WinMain.get_player_info() self.sclIDs.ls = [l for l in self.lsIDs] self.sclIDs.ls.sort() # Exclude IDs already matched to RFID values for v in self.WinMain.player_info: if v[1] == "1" and v[0] in self.sclIDs.ls: self.sclIDs.ls.remove(v[0]) def set_lbls(self, lblPrompt="Unknown RFID:", lblRFID="____________", lblPromptText="Select your name from the list."): self.lblPrompt.set_text(lblPrompt) self.lblRFID.set_text(lblRFID) self.lblPromptText.set_text(lblPromptText)
class WinIdentify(WahCade): """Window allowing the user to identify themself""" def __init__(self, WinMain): # Set main window self.WinMain = WinMain # Build the window self.winID = gtk.Fixed() self.winID.set_has_window(True) self.imgBackground = gtk.Image() self.lblPrompt = gtk.Label() self.lblPromptText = gtk.Label() self.lblRFID = gtk.Label() self.sclIDs = ScrollList(self.WinMain) self.winID.add(self.imgBackground) self.winID.add(self.lblPrompt) self.winID.add(self.lblPromptText) self.winID.add(self.lblRFID) self.winID.add(self.sclIDs.fixd) WinMain.fixd.add(self.winID) self.imgBackground.show() self.lblPrompt.show() self.lblPromptText.show() self.winID.show() # Build list self.ldap = LoadLDAP() self.lsIDs = self.ldap.getNames() self.sclIDs.auto_update = True # Get keyboard & mouse events self.sclIDs.connect("update", self.on_sclIDs_changed) self.sclIDs.connect("mouse-left-click", self.on_sclIDs_changed) self.sclIDs.connect("mouse-double-click", self.ID_selected) # Init window self.set_lbls() self.record = False self.on_keypress = False def setRFIDlbl(self, value): """Sets RFID number""" self.lblRFID.set_text(value) def on_sclIDs_changed(self, *args): """Selected user identity changed""" # Update list widget self.sclIDs._update_display() # print self.sclIDs.ls[self.sclIDs.get_selected()] return def ID_selected(self, *args): """ID selected""" return def Setup_IDs_list(self, login_type="automatic"): """Generates the list of unregistered users""" if login_type == "automatic": self.WinMain.player_info = self.WinMain.get_player_info() self.sclIDs.ls = [l for l in self.lsIDs] self.sclIDs.ls.sort() # Exclude IDs already matched to RFID values for v in self.WinMain.player_info: if v[1] != "1" and v[0] in self.sclIDs.ls: self.sclIDs.ls.remove(v[0]) elif login_type == "manual": self.WinMain.player_info = self.WinMain.get_player_info() self.sclIDs.ls = [l for l in self.lsIDs] self.sclIDs.ls.sort() # Exclude IDs already matched to RFID values for v in self.WinMain.player_info: if v[1] == "1" and v[0] in self.sclIDs.ls: self.sclIDs.ls.remove(v[0]) def set_lbls( self, lblPrompt="Unknown RFID:", lblRFID="____________", lblPromptText="Select your name from the list." ): self.lblPrompt.set_text(lblPrompt) self.lblRFID.set_text(lblRFID) self.lblPromptText.set_text(lblPromptText)