コード例 #1
0
ファイル: oscRemote.py プロジェクト: hoshijirushi/Vega
	def ping_handler(self,addr, tags, stuff, source):
		
		# save address where ping came from
		pingSource = OSC.getUrlStr(source).split(':')[0]
		if settings.get('remoteControlAddress') != pingSource:
			settings.set('remoteControlAddress',pingSource)
		
		# read the port of the remote control programm from settings
		port = settings.get('remoteControlPort')
		
		# send pong message back
		client = OSC.OSCClient()
		msg = OSC.OSCMessage()
		msg.setAddress("/vega/pong")
		msg.append(1234)
		client.sendto(msg, (pingSource, port))
コード例 #2
0
ファイル: init.py プロジェクト: kazuoteramoto/alot
            alotconfig = configfilename
            break  # use only the first

    try:
        if not alotconfig:
            alotconfig = configfiles[0]
            settings.write_default_config(alotconfig)

        settings.read_config(alotconfig)
        settings.read_notmuch_config(notmuchconfig)
    except (ConfigError, OSError, IOError), e:
        sys.exit(e)

    # store options given by config swiches to the settingsManager:
    if args['colour-mode']:
        settings.set('colourmode', args['colour-mode'])

    # get ourselves a database manager
    dbman = DBManager(path=args['mailindex-path'], ro=args['read-only'])

    # determine what to do
    try:
        if args.subCommand == 'search':
            query = ' '.join(args.subOptions.args)
            cmdstring = 'search %s %s' % (args.subOptions.as_argparse_opts(),
                                          query)
            cmd = commands.commandfactory(cmdstring, 'global')
        elif args.subCommand == 'compose':
            cmdstring = 'compose %s' % args.subOptions.as_argparse_opts()
            cmd = commands.commandfactory(cmdstring, 'global')
        else:
コード例 #3
0
ファイル: init.py プロジェクト: t-8ch/alot
            alotconfig = configfilename
            break  # use only the first

    try:
        if not alotconfig:
            alotconfig = configfiles[0]
            settings.write_default_config(alotconfig)

        settings.read_config(alotconfig)
        settings.read_notmuch_config(notmuchconfig)
    except (ConfigError, OSError, IOError), e:
        sys.exit(e)

    # store options given by config swiches to the settingsManager:
    if args['colour-mode']:
        settings.set('colourmode', args['colour-mode'])

    # get ourselves a database manager
    dbman = DBManager(path=args['mailindex-path'], ro=args['read-only'])

    # determine what to do
    try:
        if args.subCommand == 'search':
            query = ' '.join(args.subOptions.args)
            cmdstring = 'search %s %s' % (args.subOptions.as_argparse_opts(),
                                          query)
            cmd = commands.commandfactory(cmdstring, 'global')
        elif args.subCommand == 'compose':
            cmdstring = 'compose %s' % args.subOptions.as_argparse_opts()
            cmd = commands.commandfactory(cmdstring, 'global')
        else:
コード例 #4
0
ファイル: windows.py プロジェクト: Ramlak/HeapTrace
 def save(self):
     settings.set('new trace', 'EXECUTABLE', self.textExecutable.text())
     settings.set('new trace', 'ARGUMENTS_TEXT', self.textArguments.text())
     settings.set('new trace', 'ARGUMENTS_FILE', self.textArgumentsFile.text())
     settings.set('new trace', 'ARGUMENTS_USE_FILE', str(self.checkBoxTakeArgumentsFromFile.isChecked()))
     settings.set('new trace', 'START_DIR', os.path.realpath(self.textStartDirectory.text()))
     settings.set('new trace', 'TCP_WRAPPER_PORT', str(self.spinBoxWrapperPort.value()))
     settings.set('new trace', 'USE_TCP_WRAPPER', str(self.checkBoxUseWrapper.isChecked()))
     self.parent().status("Saved")
コード例 #5
0
ファイル: windows.py プロジェクト: Ramlak/HeapTrace
 def accept(self):
     settings.set('main', 'NEW_TERMINAL_COMMAND', self.textTerminalCmd.text())
     settings.set('main', 'TCP_WRAPPER_COMMAND', self.textTCPWrapper.text())
     super(ConfigureWindow, self).accept()
コード例 #6
0
ファイル: objs.py プロジェクト: 2028games/PurpleFace
    def update(self, **kwargs):
        if not Purple.paused:
            if self.check_grid((32, 32)):  # checks grid

                if not self.position == self.previous_pos:
                    # update move achievement
                    achievements.achievements["total_dist"].main_value += 32

                    # aheradrim
                    if (
                        self.position[0] == -96
                        and not Purple.aheradrim
                        and "secret" in maingame.maingame.levels.current().description
                    ):
                        achievements.achievements["aheradrim"].main_value = 1
                        Purple.aheradrim = True
                        self.image = Images.aheradrim_image

                # collision with Paint
                other = Paint.all.check_same_pos(self)
                if other:
                    achievement = achievements.achievements["paint_collected"]
                    achievement.main_value += 1

                    maingame.maingame.audio.sfx_pickup.play()
                    other.destroy()
                    if len(Paint.all) == 0:
                        Exit.all.get_sprite(0).enable()

                if not self.on_grid_update():  # if update was not handled by parent
                    # handle it now
                    # collision with Exit
                    other = Exit.all.check_same_pos(self)
                    if other:
                        if other.check_enabled():
                            # LEVEL WON

                            # first add to the list of won levels
                            current_level_location = maingame.maingame.levels.current().source_tmx
                            levels_won = settings.get("levels_won")
                            if current_level_location not in levels_won:
                                levels_won.append(current_level_location)

                            # then increment unlocked if needed
                            unlocked = settings.get("unlocked")
                            if maingame.maingame.levels.current_index() == unlocked - 1:
                                settings.set("unlocked", unlocked + 1)

                            settings.save()  # and save

                            if maingame.maingame.levels.jump_next():  # reached the end
                                if maingame.maingame.levels.current_directory_index() == 0:
                                    maingame.maingame.controller = controllers.EndGameController()  # end game screen
                                else:
                                    maingame.maingame.controller = controllers.LevelSelectionController()
                            return

                    # collision with Tutorial
                    other = Tutorial.all.check_same_pos(self)
                    if other and not other.inactive:
                        dialogs.Message("Tutorial", Tutorial.messages[Tutorial.current])
                        Tutorial.current = min(Tutorial.current + 1, len(Tutorial.messages) - 1)
                        other.destroy()

                    # handle keyboard
                    if self.speed == (0, 0) or not Ice.all.check_same_pos(self):  # if we are not sliding
                        if self.collided <= 0:  # if it is not moving then set speed according to key pressed
                            self.speed = tsoliasgame.vector2.multiply(Purple.spd, Purple.direction)
                        else:
                            self.speed = (0, 0)

                # anyway check if target position is occupied
                if self.check_collision_ahead(Wall.all) and not Purple.aheradrim:  # collision with wall
                    self.speed = (0, 0)  # set speed to 0
                else:
                    other = self.check_collision_ahead(WoodenBox.all)  # collision with wooden box
                    if other:
                        if tsoliasgame.vector2.get_length(self.speed) <= Purple.spd:
                            self.speed = (0, 0)
                        else:
                            other.destroy()
                            maingame.maingame.audio.sfx_break.play()

            else:  # not on grid
                other = pygame.sprite.spritecollideany(
                    self, Rock.all, tsoliasgame.Obj.collide_circle
                )  # check collision with rocks
                if other:
                    other.speed = self.speed
                    # if there is another rock or wall ahead of the collided rock
                    if (
                        other.check_collision_ahead(Wall.all)
                        or other.check_collision_ahead(Rock.all)
                        or other.check_collision_ahead(WoodenBox.all)
                    ):
                        self.speed = (0, 0)  # set the speed of everything to 0 and snap to grid
                        self.snap_grid((32, 32))
                        other.speed = (0, 0)

                    else:
                        other.collided = True
                        # the other.collided will prevent the rock from instantly setting its speed to 0

                        self.speed = tsoliasgame.vector2.multiply(-1, other.speed)  # reverse self speed

                    self.collided = int(maingame.maingame.get_fps() * 0.3)
                    # and set self.collided so that we dont allow keypresses to work for ~500ms

        self.collided -= 1

        # HANDLE ANIMATION
        self.on_update_end()
        if not self.paused and not Purple.aheradrim:
            # BLINK ANIMATION - ONLY IF NOT PAUSED
            if self.current_image == 0:
                if self.__blink <= 0:
                    self.animation_enabled = True
                    self.__blink = maingame.maingame.fps * 10
                else:
                    self.animation_enabled = False
                    self.__blink -= 1

        tsoliasgame.Obj.update(
            self,
            not Purple.paused or "secret" in maingame.maingame.levels.current().description and self.position[0] <= 256,
        )
コード例 #7
0
ファイル: oscRemote.py プロジェクト: hoshijirushi/Vega
	def settings_handler(self,addr, tags, stuff, source):
		if stuff[0] == 'save':
			settings.save()
		else:
			settings.set(stuff[0],stuff[1])