Beispiel #1
0
    def __init__(self,screen):
        Mode.__init__(self,screen)
        #create a loading screen
        Loading(screen)
        self.loading = True
        
        #border color
        self.surface.fill((0,0,0))
        
        screen.blit(self.surface,(0,0))
        #create border at top and bottom
        self.game_dimension = (screen.get_size()[0],screen.get_size()[1]*0.75)
        self.game_surface = pygame.Surface(self.game_dimension)
        
        #MUST BE FIXED
        self.stage = Stage(self.game_dimension)
        self.stage.load_stage('Intro')
        self.map = self.stage.rooms[0]
        

        #133442__klankbeeld__horror-ambience-11.wav
        pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
        
        
        
        self.fade = Fade(screen,'in',3)
        #add player
        self.player = Player(self.map.spawn_x,self.map.spawn_y,self.map.entity)
        
        self.map.entity.append(self.player)
        self.shade = Shade(self.player,0,self.fade.surface)
        #test
        self.loading = False
        self.next_before = True
Beispiel #2
0
    def __init__(self,screen,player):
        self.player = player
        Mode.__init__(self,screen)

        buttons = OrderedDict()

        buttons.update({'health upgrade':self.health_upgrade_cost(self.player.status['health'].maximum)})
        buttons.update({'stamina upgrade':self.stamina_upgrade_cost(self.player.status['stamina'].maximum)})
        buttons.update({'brightness upgrade':self.lighting_upgrade_cost(self.player.brightness)})
        buttons.update({'stamina regeneration': ''})
        buttons.update({'climbing upgrade':''})
        buttons.update({ 'Exit':''})
#         buttons = OrderedDict({
#                                
#                                'stamina regeneration': '', \
#                                'climbing upgrade':'', \
#                                'Exit':'', \
#                                'brightness upgrade':self.player.brightness,\
#                                'stamina_upgrade':self.player.status['stamina'].maximum, \
#                                'health upgrade':self.player.status['health'].maximum})
        buttons = self.check_buttons(buttons)
        
        self.buttons = self.create_buttons(buttons)
        #the first button is chosen by default
        self.cursor = 0
        self.current_button = self.buttons[self.cursor]
Beispiel #3
0
 def __init__(self, device, database):
     Mode.__init__(self, database, "temperature")
     if self.isReadMode():
         self.__temp = ds18b20.Temperature(device)
     self.__current = 0.0
     self.__dayMax = -273.0
     self.__winter = 10.0
Beispiel #4
0
    def __init__(self, screen):
        Mode.__init__(self, screen)
        #create a loading screen
        Loading(screen)
        self.loading = True

        #border color
        self.surface.fill((0, 0, 0))

        screen.blit(self.surface, (0, 0))
        #create border at top and bottom
        self.game_dimension = (screen.get_size()[0],
                               screen.get_size()[1] * 0.75)
        self.game_surface = pygame.Surface(self.game_dimension)

        #MUST BE FIXED
        self.stage = Stage(self.game_dimension)
        self.stage.load_stage('Intro')
        self.map = self.stage.rooms[0]

        #133442__klankbeeld__horror-ambience-11.wav
        pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)

        self.fade = Fade(screen, 'in', 3)
        #add player
        self.player = Player(self.map.spawn_x, self.map.spawn_y,
                             self.map.entity)

        self.map.entity.append(self.player)
        self.shade = Shade(self.player, 0, self.fade.surface)
        #test
        self.loading = False
        self.next_before = True
Beispiel #5
0
 def __init__(self,
              debug,
              database,
              default,
              robot,
              redox,
              ph,
              temperature,
              debounce_ms=10):
     Mode.__init__(self, database, "pump")
     self.__lock = threading.RLock()
     Relay.__init__(self, self.PUMP_GPIO_PIN)
     self.__debug = debug
     self.__default = default
     self.__robot = robot
     self.__redox = redox
     self.__ph = ph
     self.__temperature = temperature
     self.__guard = self.GUARD_PERIOD
     self.__previousMode = None
     self.__moveDebounce = None
     GPIO.setup(self.LIQUID_MOVE_GPIO_PIN,
                GPIO.IN,
                pull_up_down=GPIO.PUD_UP)
     GPIO.add_event_detect(self.LIQUID_MOVE_GPIO_PIN,
                           GPIO.BOTH,
                           callback=self.__moveGpioDetect,
                           bouncetime=debounce_ms)
     self.autoPrograms = list()
     self.programs = list()
     self.fullAuto = True
Beispiel #6
0
    def __init__(self, screen, player):
        self.player = player
        Mode.__init__(self, screen)

        buttons = OrderedDict()

        buttons.update({
            'health upgrade':
            self.health_upgrade_cost(self.player.status['health'].maximum)
        })
        buttons.update({
            'stamina upgrade':
            self.stamina_upgrade_cost(self.player.status['stamina'].maximum)
        })
        buttons.update({
            'brightness upgrade':
            self.lighting_upgrade_cost(self.player.brightness)
        })
        buttons.update({'stamina regeneration': ''})
        buttons.update({'climbing upgrade': ''})
        buttons.update({'Exit': ''})
        #         buttons = OrderedDict({
        #
        #                                'stamina regeneration': '', \
        #                                'climbing upgrade':'', \
        #                                'Exit':'', \
        #                                'brightness upgrade':self.player.brightness,\
        #                                'stamina_upgrade':self.player.status['stamina'].maximum, \
        #                                'health upgrade':self.player.status['health'].maximum})
        buttons = self.check_buttons(buttons)

        self.buttons = self.create_buttons(buttons)
        #the first button is chosen by default
        self.cursor = 0
        self.current_button = self.buttons[self.cursor]
Beispiel #7
0
    def __init__(self, buttons, screen):
        Mode.__init__(self, screen)

        self.buttons = self.create_buttons(buttons)
        #the first button is chosen by default
        self.cursor = 0
        self.current_button = self.buttons[self.cursor]
Beispiel #8
0
 def __init__(self,buttons,screen):
     Mode.__init__(self,screen)
     
     self.buttons = self.create_buttons(buttons)
     #the first button is chosen by default
     self.cursor = 0
     self.current_button = self.buttons[self.cursor]
Beispiel #9
0
 def __init__(self, database):
     Mode.__init__(self, database, "curtain")
     self.__lock = threading.RLock()
     self.__r1 = Relay(self.R1_GPIO_PIN)
     self.__r2 = Relay(self.R2_GPIO_PIN)
     self.__timer = None
     self.stop()
Beispiel #10
0
 def __init__(self, drone, angle=0, dz=0, relative=False):
     Mode.__init__(self, drone)
     self.angle = angle
     self.dz = dz
     self.obstacles = []
     self.relative = relative
     self.name = drone.namespace.strip('/')
Beispiel #11
0
 def __init__(self, database, default, analog):
     Mode.__init__(self, database, "pressure")
     self.__default = default
     self.__analog = analog
     self.__current = 0.0
     self.__max = 1.3
     self.__dayMax = 0.0
     self.__critical = 1.5
Beispiel #12
0
    def __init__(self, core):
        Mode.__init__(self, core, 30)

        self.menuButtons = [
            MenuButton("Start New Game", self.onStartGameClick),
            MenuButton("Instructions", self.onInstructionsClick),
            MenuButton("Exit", self.onExitClick),
        ]
        self.activeButton = 0

        self.backdrop = image.load(os.path.join(GRAPHICPATH, "menu_backdrop.jpg"))
        self.menuSound = mixer.Sound(os.path.join(SOUNDPATH, "menu_click.wav"))
    def __init__(self, app):
        Mode.__init__(self, app)
        self._app = app
        self.box = Gtk.VBox()
        self._keys = ['dummy_key', 'KP_Up', 'KP_Down']

        OverlayWidget.__init__(self, self.box)
        ModesComboHeader.__init__(self, constants.MODE_ZOOM, self,
                                  'bookreader-dummy-zoom', app, False)

        self._screen = Gdk.Screen.get_default()

        self.set_size_request(self._width, self._height)
    def __init__(self, app):
        Mode.__init__(self, app)
	self._app = app
        self.box = Gtk.VBox()
        self._keys = ['dummy_key', 'KP_Up', 'KP_Down']


        OverlayWidget.__init__(self, self.box)
        ModesComboHeader.__init__(self, constants.MODE_ZOOM, self,
                                  'bookreader-dummy-zoom', app, False)

        self._screen = Gdk.Screen.get_default()

        self.set_size_request(self._width, self._height)
Beispiel #15
0
 def __init__(self, debug, database, default, analog):
     Mode.__init__(self, database, "redox")
     self.__lock = threading.RLock()
     Relay.__init__(self, self.CL_GPIO_PIN)
     self.__debug = debug
     self.__default = default
     self.__analog = analog
     self.__injectionTimer = None
     self.__current = 0
     self.__waitTick = 0
     self.__injection = 37.5  # 250ml
     self.__wait = 600 / REFRESH_TICK  # 10mn de stabilisation
     self.offset = 0
     self.idle = 650
Beispiel #16
0
 def __init__(self,hlt_code,mpg, instr_manager, ptg, threads, simcmd, intel, interrupt,c_parser=None):
     self.inc_path = ""
     self.hlt_code = hlt_code
     Mode.__init__(self,mpg, instr_manager, ptg, threads, simcmd, intel, interrupt,c_parser)
     self.vmxon = []
     self.vmxon_pointer = []
     self.vmcs = []
     self.vmcs_pointer = []
     self.vmx_guest_entry_0 = []
     self.vmcs_data=[]
     self.vmcs_initial_code = []
     self.vmx_exit_addr = []
     #self.multi_ept = 0
     self.osystem = None
Beispiel #17
0
 def __init__(self,screen):
     Mode.__init__(self,screen)
     #create a loading screen
     Loading(screen)
     #now do all the intial stuff
     self.surface.fill((0,0,0))
     screen.blit(self.surface,(0,0))
     #create border at top and bottom
     game_dimension = (screen.get_size()[0],screen.get_size()[1]*0.75)
     self.game_surface = pygame.Surface(game_dimension)
     
     self.stage = Stage(game_dimension)
     self.stage.load_stage('round_1')
     self.map = self.stage.rooms[0]
     self.fade = Fade(screen,'in',3)
     #add player
     self.player = Player(self.map.spawn_x,self.map.spawn_y,self.map.entity)
     
     self.map.entity.append(self.player)
Beispiel #18
0
 def __init__(self, debug, database, default, pump, redox, ph, i2c):
     Mode.__init__(self, database, "panel")
     self.__lock = threading.RLock()
     self.__debug = debug
     self.__default = default
     self.__redox = redox
     self.__ph = ph
     self.__pump = pump
     if not self.isNoneMode():
         self.__encoder = Encoder(False,
                                  self.ENCODER_EVENT_GPIO_PIN,
                                  self.__encoderMove,
                                  bus=i2c)
         self.__button = Button(self.ENCODER_SWITCH_GPIO_PIN, 1000,
                                self.__validButton, GPIO.RISING)
         self.__lcd = LCD(0x27, bus=i2c)
         self.__lcdMenu = "default"
         self.__delay = self.LCD_LIGHT_TICK / REFRESH_TICK
     self.__lcdLightTimer = 0
     self.__calib = None
Beispiel #19
0
    def __init__(self, screen):
        Mode.__init__(self, screen)
        #create a loading screen
        Loading(screen)
        #now do all the intial stuff
        self.surface.fill((0, 0, 0))
        screen.blit(self.surface, (0, 0))
        #create border at top and bottom
        game_dimension = (screen.get_size()[0], screen.get_size()[1] * 0.75)
        self.game_surface = pygame.Surface(game_dimension)

        self.stage = Stage(game_dimension)
        self.stage.load_stage('round_1')
        self.map = self.stage.rooms[0]
        self.fade = Fade(screen, 'in', 3)
        #add player
        self.player = Player(self.map.spawn_x, self.map.spawn_y,
                             self.map.entity)

        self.map.entity.append(self.player)
Beispiel #20
0
    def __init__(self, game, playerWon = False):
        Mode.__init__(self, game.core, 30)
        self.game = game
        self.playerWon = playerWon

        self.lastScreen = game.core.screen

        if self.playerWon:
            filenameSound = "win.ogg"
            filenameTopic = "topic_won.png"
        else:
            filenameSound = "lose.ogg"
            filenameTopic = "topic_lost.png"

        self.music = mixer.Sound(os.path.join(SOUNDPATH, filenameSound))
        self.music.play(loops=-1, fade_ms=300)

        self.imageTopic = image.load(os.path.join(GRAPHICPATH, filenameTopic))
        self.imageFrame = image.load(os.path.join(GRAPHICPATH, "endgame_frame.png"))

        self.fontHeader = font.Font(None, 70)
        self.fontContent = font.Font(None, 50)
Beispiel #21
0
    def __init__(self, app):
        Mode.__init__(self, app)
	self._app = app
        self.box = Gtk.VBox()

        OverlayWidget.__init__(self, self.box)
        ModesComboHeader.__init__(self, constants.MODE_SELECT_FILE, self,
                                  'bookreader-libraries', app, True)

        self._screen = Gdk.Screen.get_default()

        self.set_size_request(self._width, self._height)

        sw = Gtk.ScrolledWindow()
        sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.box.pack_start(sw, True, True, 0)

        self._treeview = TreeView()
        sw.add(self._treeview)

        self._my_library_tab = self._app.get_my_library_tab()
Beispiel #22
0
 def __init__(self, drone, takeoff=False):
     Mode.__init__(self, drone)
     self.takeoff = takeoff
Beispiel #23
0
 def __init__(self, debug, database):
     Mode.__init__(self, database, "robot")
     Relay.__init__(self, self.ROBOT_GPIO_PIN)
     self.__debug = debug
     self.programs = list()
Beispiel #24
0
 def __init__(self, screen):
     Mode.__init__(self, screen)
Beispiel #25
0
 def __init__(self, drone, direction=0):
     Mode.__init__(self, drone)
     self.direction = direction  # -1 = CW, 1 = CCW, 0 = absolute angle
     self.angle = 0
Beispiel #26
0
 def __init__(self, database):
     Mode.__init__(self, database, "light")
     Relay.__init__(self, self.LIGHT_GPIO_PIN)
     self.__lock = threading.RLock()
     self.__timer = None
     self.switchOff()