Example #1
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]
Example #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]
Example #3
0
def main():
    m = Mode(init())
    log_count = 1
    while True:
        try:
            if NIGHT_REST[0] >= datetime.now().hour >= NIGHT_REST[1]:
                LED.blue()
                LOGGER.info("Start turning mode function")
                # turning mode function
                m.mode_3(rotations=100)
                # m.mode_2(turn=5)
                # m.mode_1(turn=10, sleep_time=0.5)
                log_count = 1
            else:
                LED.red()
                if log_count > 0:
                    LOGGER.info("Night rest, sleeping...")
                    log_count -= 1
            w = random.randint(WAIT_PERIOD_RANGE[0] * 60,
                               WAIT_PERIOD_RANGE[1] * 60)
            LOGGER.info(
                f"Wait {w} seconds until next try ({round(w / 60, 1)} minutes)")
            sleep(w)
        except KeyboardInterrupt:
            LOGGER.warning(f"Interrupted by user input")
            LED.off()
            exit(1)
        except Exception as e:
            LOGGER.error(f"Any error occurs: {e}")
            LED.blink_red()
            exit(1)
Example #4
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
Example #5
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()
Example #6
0
    def add_mode(self, mode_number, resource, start, dur):
        """
        add mode to operation with the needed resource for the mode.
        if it is a new mode number, create him.
        save the resource in all_resources list.
        mode_number: string - the number of the mode
        resource: Resource - a resource that the mode need
        resource_start: float - local start time of the resource in the mode
        resource_dur: float - the duretion of the resource usage
        return: None
        """
        # save all needed resources for every mode in all_resources dictionary
        if resource not in self.all_resources:
            self.all_resources[resource] = [mode_number]

        else:
            self.all_resources[resource].append(mode_number)

        for mode in self.modes:
            # check if mode exists
            if mode.mode_number == mode_number:
                # add mode data to existing mode
                mode.add_resource(resource, start, dur)
                return

        # if it is new mode, create it and add it to operation modes list
        mode = Mode(mode_number, self.number)
        mode.add_resource(resource, start, dur)
        self.modes.append(mode)
Example #7
0
def main():
    mode = Mode()
    musicList = MusicList()
    selectMusic = SelectMusic()
    musicStart = MusicStart()
    listUp = ListUp()
    conf = Conf()

    conf.existence()

    listUp.listUp()

    modeFlag = mode.selectMode()
    while modeFlag == "EOF":
        modeFlag = mode.selectMode()

    if modeFlag == "loop":
        print("\n")
        musicList.musicList()
        print("\n")
        musicStart.loop()

    if modeFlag == "single":
        print("\n")
        musicList.musicList()
        number = selectMusic.selectMusic()
        print("\n")
        musicStart.single(number)
Example #8
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
Example #9
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
Example #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('/')
Example #11
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
Example #12
0
def test(config, name, path):

    if name == 'coco':
        classes = open('./data/coco.names', 'r').read().split('\n')[:-1]
        colors = random_colors(80)
    elif name == 'voc':
        classes = [
            "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car",
            "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike",
            "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"
        ]
        colors = random_colors(20)
    else:
        raise Exception('name must be coco or voc')

    if path is not None:
        logging.info('Read image from {}'.format(path))
        image = cv2.imread(path)
        if image is None:
            raise Exception('Read image error: {}'.format(path))
    else:
        raise Exception('You must input right image path')

    model = Mode(config, False)

    image, time = model.inference(image, classes, colors)
    logging.info('cost %.2f' % time)
    cv2.imwrite('prediction.jpg', image)
Example #13
0
def demo(config, name, path=None):
    if name == 'coco':
        classes = open('./data/coco.names', 'r').read().split('\n')[:-1]
        colors = random_colors(80)
    elif name == 'voc':
        classes = [
            "aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car",
            "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike",
            "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"
        ]
        colors = random_colors(20)
    else:
        raise Exception('name must be coco or voc')

    model = Mode(config, False)

    if path is not None:
        logging.info('Reading vedio from {}'.format(path))
        cap = cv2.VideoCapture(path)
    else:
        logging.info('Realtime detectiong')
        cap = cv2.VideoCapture(0)

    while True:
        ret, frame = cap.read()
        image, time = model.inference(frame, classes, colors)
        logging.info('FPS : %.2f' % (float(1 / time)))
        cv2.imshow('frame', image)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
Example #14
0
 def spawnMode(self, speed=1):
     self.mode.pop(self.modeCount)
     self.mode.insert(self.modeCount, Mode("SPAWN", speedMult=speed))
     self.modeTimer = 0
     for x in self.guide:
         self.mode.insert(self.modeCount + 1,
                          Mode("GUIDE", speedMult=0.5, direction=x))
Example #15
0
    def __init__(self, nodes):  #DONE
        Base.__init__(self, nodes)
        self.name = "Ghost"
        self.points = 200
        self.speed = 100
        self.goal = Vector2()
        self.node = nodes.points[10]
        self.target = self.node
        self.recent_position()
        self.ID = -1

        self.release_pellet = 0
        self.block = []
        self.out = False
        self.draw_release = False  #Draw normally because usually spawn means frightened sprite

        self.guide = [UP]

        self.modetime = 0  #time for a mode counting...
        self.modeCount = 0
        self.mode = [Mode(name="CHASE"), Mode(name="CHASE")]
        """self.reset = [Mode(name="SCATTER", time=7), Mode(name="CHASE", time=20), 
                      Mode(name="SCATTER", time=7), Mode(name="CHASE", time=20), 
                      Mode(name="SCATTER", time=5), Mode(name="CHASE", time=20), 
                      Mode(name="SCATTER", time=5), Mode(name="CHASE")]"""#reset the self.mode because it can be modified by frightened mode
        #I just put here in case I need it XD
        self.spawnnode = self.findSNode()
Example #16
0
def train(config):
    model = Mode(config, True)
    train_dataloader = torch.utils.data.DataLoader(
        COCODataset(config.train_list,
                    config.image_size,
                    True,
                    config.batch_size,
                    config.jitter,
                    shuffle=True,
                    seed=config.seed,
                    random=True,
                    num_workers=config.num_workers),
        batch_size=config.batch_size,
        shuffle=False,
        num_workers=config.num_workers,
        pin_memory=True)

    val_dataloader = torch.utils.data.DataLoader(
        COCODataset(config.val_list, config.image_size, False,
                    config.batch_size, config.jitter),
        batch_size=config.batch_size,
        shuffle=False,
        num_workers=config.num_workers,
        pin_memory=True)

    model.train(train_dataloader, val_dataloader)
Example #17
0
def update_displays():
    global inputBuffer

    if Mode.isEditting():
        try:
            controlls['stackX'].text = Conv.str(RPN.y())
        except IndexError:
            controlls['stackX'].text = ''

        controlls['stackY'].text_color = 'blue'

        controlls['stackY'].text = re.sub(
            r'(\d)(?=(\d{3})+$)', '\\1,',
            inputBuffer) if not '.' in inputBuffer else re.sub(
                r'(\d)(?=(\d{3})+\.)', '\\1,', inputBuffer)

    elif Mode.isFixed():
        try:
            controlls['stackX'].text = Conv.str(RPN.x())
        except IndexError:
            controlls['stackX'].text = ''

        controlls['stackY'].text_color = 'black'
        try:
            controlls['stackY'].text = Conv.str(RPN.y())
        except IndexError:
            controlls['stackY'].text = ''
Example #18
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]
Example #19
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]
Example #20
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
Example #21
0
def fix_inputBuffer():
    global inputBuffer

    try:
        val = Conv.num(inputBuffer)
        RPN.enter(val)
        Mode.setFixed()
        inputBuffer = ''
    except ValueError:
        raise ValueError
Example #22
0
def swap_key_tapped(sender):
    if Mode.isEditting():
        try:
            fix_inputBuffer()
            RPN.swap()
        except ValueError:
            pass
    elif Mode.isFixed():
        RPN.swap()

    update_displays()
Example #23
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"))
Example #24
0
def OFB_test():
    mode = Mode()
    cb = Convert()
    ce = Crypto_Exec(128)
    string = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    b = ce.block_split(string)
    value = cb.convert_bin(b)
    IV = "B" * 16
    t = mode.IV_genrate(IV)
    encrypto = mode.OFB_mode(value, t)
    decrypto = mode.OFB_mode(encrypto, t)
    t = cb.convert_str(decrypto)
Example #25
0
def supervisor(_bladed, _run_dir):
    mode_map = {
        '3.82': 'Tower side-side mode 1',
        '4.3': 'Tower mode 1',
        '4.6': 'Tower mode 1',
        '4.7': 'Tower 1st side-side mode',
    }
    # _bladed.solo_run(_run_dir, dll_path, xml_path)
    # _bladed.campbell(_run_dir)
    mode = Mode(_run_dir)
    tower_mode_1 = mode.get_freq(mode_map[_bladed.version])
    print(tower_mode_1)
Example #26
0
def CFB_test():
    mode = Mode()
    cb = Convert()
    ce = Crypto_Exec(128)
    string = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    b = ce.block_split(string)
    value = cb.convert_bin(b)
    IV = "C" * 16
    t = mode.IV_genrate(IV)
    testd = mode.CFB_encrypto(value, t)
    correct = mode.CFB_decrypto(testd, t)
    td = cb.convert_str(correct)
    print(td)
    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)
Example #29
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
Example #30
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
Example #31
0
 def __init__(self, color):
     self.drone = Drone('/' + color)
     self.color = color
     drone = self.drone
     self.modes = {
         "idle": Mode(drone),
         "follow": FollowGesture(drone),
         "land": TakeoffLand(drone),
         "takeoff": TakeoffLand(drone, takeoff=True),
         "north": Move(drone, 0),
         "east": Move(drone, 3 * math.pi / 2),
         "south": Move(drone, math.pi),
         "west": Move(drone, math.pi / 2),
         "stop": Move(drone, 0),
         "forward": Move(drone, 0, relative=True),
         "duck": Move(drone, 0, -1),
         "jump": Move(drone, 0, 1),
         "analyze": Photo(drone)
     }
     self.look_modes = {
         "look": Turn(drone),
         "right": Turn(drone, -1),
         "left": Turn(drone, 1)
     }
     self.look_direction = 0
     self.current_mode_pub = rospy.Publisher("/" + color + "_current_mode",
                                             String,
                                             queue_size=10)
     self.look_mode_pub = rospy.Publisher("/" + color + "_look_mode",
                                          String,
                                          queue_size=10)
     self.current_mode = self.modes["idle"]
     self.look_mode = self.modes["idle"]
     print('Drone ' + color + ' initialized')
Example #32
0
    def move_items(self, mode: Mode) -> None:
        target_dir = self.true_pos if mode.get_mode() == Mode.ACCEPT \
            else self.false_pos

        files = os.listdir(self.temp)
        for f in files:
            shutil.move(os.path.join(self.temp, f), target_dir)
Example #33
0
def main():
    """
    Main function. Creates the window and the canvas.
    """
    window = tk.Tk()

    #####################################################################
    # PACKAGE THIS SECTION INTO A NEW FUNCTION OR CLASS                 #
    #####################################################################
    left_frame = tk.Frame(master=window)

    mode = Mode()
    # canvas = ic.InfiniteCanvas(master=window, mode=mode)
    canvas = ic2.InfiniteCanvas2(master=window, mode=mode)
    tile_menu = tm.TileMenu(master=left_frame, mode=mode)
    menu = MainMenu(master=left_frame, mode=mode, tile_menu=tile_menu)

    left_frame.pack(side=tk.LEFT, fill=tk.Y)
    menu.pack()
    tile_menu.pack(fill=tk.Y)
    canvas.pack(side=tk.RIGHT)
    #####################################################################

    window.geometry("500x500")
    window.mainloop()
Example #34
0
def main():
    mode = Mode()
    dirs = Dirs('img')

    while True:
        m = mode.update()
        log(f'Detected mode: {mode}')

        if m == Mode.GRAB:
            log(f'Grabbing image to {dirs.temp} directory')
            grab(dirs.temp)
        elif m == Mode.ACCEPT or m == Mode.DISMISS:
            log('Moving items to target folder')
            dirs.move_items(mode)
            mode.set(Mode.STOP)

        time.sleep(0.5)
Example #35
0
def switch_mode(m_req):
    global current_mode
    if m_req in cfg["modes"]:
        if current_mode:
            del(current_mode.current_view) # Destroy old mode
            del(current_mode.views)
            del(current_mode)
        current_mode = Mode(m_req, cfg) # Create new mode with the name token
    else:
        print "Trying to switch to a mode which does not exist!"
Example #36
0
def CTR_test():
    mode = Mode()
    cb = Convert()
    ce = Crypto_Exec(128)
    string = "This is your name eding "
    b = ce.block_split(string)
    c = cb.convert_bin(b)
    t, stream_key = mode.Counter_mode(c, 8, 128, 8)
    print("ango")
    print(t)
    v, test = mode.Counter_mode(t,
                                8,
                                128,
                                8,
                                mode="decrypto",
                                stream_key=stream_key)
    print("decrypto")
    test = cb.convert_str(v)
    print(test)
Example #37
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)
Example #38
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)
    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()
Example #40
0
 def render(self,screen):      
     Mode.render(self,screen)
     #display rectangle to show chosen menu
     self.selected.fill((255,255,255))
     self.selected.set_alpha(80)
     screen.blit(self.selected,self.current_button.get_pos())
Example #41
0
##It will produce incorrect output if lines are malformed, or if
##the VIBRATION keyword's first appearance is not directly before mode data.
with open(modeFilename) as modeFile:
    modeLines = modeFile.readlines()

currentModeNumber = 0
currentModeFrequency = 0.0
for line in modeLines:
    words = str.split(line)
    if len(words) < 1:
        pass
    elif words[0] == "VIBRATION":
        currentModeNumber = words[2]
        currentModeFrequency = words[4]
    elif isInt(words[0]) and currentModeNumber != 0 and len(words) == 7: 
        newMode = Mode()
        newMode.number = currentModeNumber
        newMode.frequency = currentModeFrequency
        newMode.atomNumber = words[0]
        newMode.vector = [words[4], words[5], words[6]]
        atoms[int(newMode.atomNumber) - 1].modes.append(newMode)


#Ask user which chains (tags) they want printed to the ouput file, and remove
#atoms with these tags before printing.
tags = set()
for atom in atoms:
    if atom.tag not in tags:
        tags.add(atom.tag)
keepTags = set(tags)
Example #42
0
 def layer_1(self,screen):
     Mode.render(self,screen)
Example #43
0
def outputTofp(activity, features, fp):
    #write classType here
    fp.write(str(Mode.getIndexOfActivity(activity)))
    for cnt, feature in enumerate(features, start = 1):
        fp.write(' '+str(cnt)+':'+str(feature))
    fp.write('\n')