示例#1
0
 def __init__(self):
     reload(sys)
     sys.setdefaultencoding('UTF-8')
     self.datatype = 'main'
     self.title = 'NetEase Music'
     self.datalist = ['Ranking', 'Artist', 'Mew', 'Feature', 'Mine', 'Broadcast', 'DJing', 'Collection', 'Search',
                      'Help']
     self.offset = 0
     self.index = 0
     self.presentsongs = []
     self.player = Player()
     self.ui = Ui()
     self.netease = NetEase()
     self.screen = curses.initscr()
     self.screen.keypad(1)
     self.step = 10
     self.stack = []
     self.djstack = []
     self.userid = None
     self.username = None
     try:
         sfile = file(home + "/netease-musicbox/flavor.json", 'r')
         data = json.loads(sfile.read())
         self.collection = data['collection']
         self.account = data['account']
         sfile.close()
     except:
         self.collection = []
         self.account = {}
示例#2
0
def enter():
    global forest, retsim, ui
    retsim = Retsim()
    forest = Forest()
    ui = Ui()

    forest.set_center_object(retsim)
示例#3
0
    def __init__(self, surface: Surface, dialog_font: Font, choice_font: Font,
                 images: Dict[str, Surface], animations: Dict[str,
                                                              List[Surface]],
                 sound_player: SoundPlayer, dialog_graph: DialogGraph,
                 picture_size: Vec2, select_blip_sound_id: str):
        self._validate_inputs(dialog_graph, images, sound_player)
        self.surface = surface
        self._sound_player = sound_player
        self._dialog_graph = dialog_graph

        self._current_dialog_node = self._dialog_graph.current_node()

        background_id = self._dialog_graph.background_image_id
        background = images[background_id] if background_id else None
        self._ui = Ui(surface=surface,
                      picture_size=picture_size,
                      dialog_node=self._current_dialog_node,
                      dialog_font=dialog_font,
                      choice_font=choice_font,
                      images=images,
                      animations=animations,
                      sound_player=sound_player,
                      background=background,
                      select_blip_sound_id=select_blip_sound_id)
        self._play_dialog_sound()
示例#4
0
def enter():

    global back
    back = Back()
    game_world.add_object(back, 0)

    global stage_one_back
    stage_one_back = Stage_one_Back()
    game_world.add_object(stage_one_back, 0)

    # global ladders
    # ladders = [Ladder(ladder_position[i]) for i in range(2)]
    # for ladder in ladders:
    #     ladder.set_background(stage_one_back)
    # game_world.add_objects(ladders, 1)

    global boy
    boy = Boy()
    game_world.add_object(boy, 2)

    global mooks
    mooks = [Mook(mook_position[i]) for i in range(6)]

    for mook in mooks:
        mook.set_background(stage_one_back)
    game_world.add_objects(mooks, 4)

    stage_one_back.set_center_object(boy)
    boy.set_background(stage_one_back)

    global ui
    ui= Ui()
    game_world.add_object(ui, 6)
示例#5
0
    def __init__(self):
        self.home = os.path.expanduser("~") + '/.musicbox'
        if not os.path.isdir(self.home):
            os.mkdir(self.home)

        locale.setlocale(locale.LC_ALL, "")
        code = locale.getpreferredencoding()
        try:
            sfile = file(self.home + "/config.json", 'r')
            data = json.loads(sfile.read())
            #version check
            assert ('v' in data and data['v'] <= APP_VER)
            self.collection = data['collection']
            self.userid = data['account']['id']
            self.username = data['account']['nickname']
            self.netease = NetEase(cookie=data['account']['cookie'])
            sfile.close()
        except:
            self.collection = []
            self.userid = None
            self.username = None
            self.netease = NetEase()

        self.ui = Ui(self.netease)
        self.player = Player(self.ui)
        self.menu = Menu(self.netease, self.ui, self.player,
                         [self.userid, self.username, self.update_profile])
示例#6
0
文件: menu.py 项目: zy-lee/musicbox
    def __init__(self):
        reload(sys)
        sys.setdefaultencoding('UTF-8')
        self.datatype = 'main'
        self.title = '网易云音乐'
        self.datalist = [
            '排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '打碟', '收藏', '搜索',
            '帮助'
        ]
        self.offset = 0
        self.index = 0
        self.presentsongs = []
        self.player = Player()
        self.ui = Ui()
        self.netease = NetEase()
        self.screen = curses.initscr()
        self.screen.keypad(1)
        self.step = 10
        self.stack = []
        self.djstack = []
        self.userid = None
        self.username = None
        signal.signal(signal.SIGWINCH, self.change_term)
        signal.signal(signal.SIGINT, self.send_kill)

        try:
            sfile = file(Constant.conf_dir + "/flavor.json", 'r')
            data = json.loads(sfile.read())
            self.collection = data['collection']
            self.account = data['account']
            sfile.close()
        except:
            self.collection = []
            self.account = {}
示例#7
0
    def effect(self):
        """If there is an original element, store it. Open the GUI."""

        self.orig, self.orig_src = self.get_original()

        self.ui = Ui(self.render, self.orig_src, self.get_settings())
        self.ui.main()
示例#8
0
 def __init__(self):
     reload(sys)
     sys.setdefaultencoding('UTF-8')
     self.config = Config()
     self.datatype = 'main'
     self.title = '网易云音乐'
     self.datalist = [
         '排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '每日推荐', '私人FM', '搜索',
         '帮助'
     ]
     self.offset = 0
     self.index = 0
     self.storage = Storage()
     self.storage.load()
     self.collection = self.storage.database['collections'][0]
     self.player = Player()
     self.cache = Cache()
     self.ui = Ui()
     self.netease = NetEase()
     self.screen = curses.initscr()
     self.screen.keypad(1)
     self.step = 10
     self.stack = []
     self.djstack = []
     self.userid = self.storage.database["user"]["user_id"]
     self.username = self.storage.database["user"]["nickname"]
     self.resume_play = True
     self.at_playing_list = False
     signal.signal(signal.SIGWINCH, self.change_term)
     signal.signal(signal.SIGINT, self.send_kill)
     self.START = time.time()
示例#9
0
    def __init__(self, app, loop, engine):

        super().__init__()

        self.app = app
        self.loop = loop
        self.engine = engine

        self.timers = {}

        self.event_bus = EventBus(loop, self)

        self.ui = Ui()
        self.ui.show()

        self.ui.shortcut_close.activated.connect(self.close_app)

        self.ui.decks[0].play_pause.connect(self.play_pause_clicked)
        self.ui.decks[1].play_pause.connect(self.play_pause_clicked)
        self.ui.decks[0].tempo_changed.connect(self.tempo_changed)
        self.ui.decks[1].tempo_changed.connect(self.tempo_changed)

        self.ui.cross_fader.valueChanged.connect(self.cross_fade)

        self.social_controller = SocialController(self, self.ui)

        self.library_controller = LibraryController(self, self.ui)
示例#10
0
def main():

    #Datastructure for faces and names
    fd = FaceData()

    rec = Recognition()

    root = Tk()
    ui = Ui(root, fd)

    def task():
        #while True:
        #print("length: "+ str(len(known_face_names)))
        rec.find_faces(fd)
        ui.updateList()

        ## TODO:  Hit 'q' on the keyboard to quit!
        if cv2.waitKey(1) & 0xFF == ord('q'):
            print("q pressed")
        #    break
        root.after(20, task)  # reschedule event in 2 seconds

    root.after(20, task)
    ui.startLoop()

    rec.close()
示例#11
0
def run():
    try:
        ui = Ui()
    except ValueError as ve:
        print(ve)
        return

    ui.run()
示例#12
0
 def __init__(self):
     self.ui = Ui()
     self.datatype = 'songs'
     self.popen_handler = None
     # flag stop, prevent thread start
     self.playing_flag = False
     self.pause_flag = False
     self.songs = []
     self.idx = 0
示例#13
0
    def __init__(self, board: Board, cell_size):
        self._board = board
        self._ui = Ui(cell_size, self._board)
        self._new_generation_delay = 100
        self._quit = False
        self._generation_update_enabled = False

        # Mouse motions would trigger unnecessary redraw events very frequently
        pygame.event.set_blocked(pygame.MOUSEMOTION)
    def __create_and_init_UI(self):
        """[summary]
        """
        self.POSTAGE_SERVICE_UI = wx.App()
        self.FRAME = Ui(self.name, parent=None, id=-1, app=self)

        self.FRAME.Centre()
        self.FRAME.Show()
        self.POSTAGE_SERVICE_UI.MainLoop()
示例#15
0
文件: game.py 项目: Helyosis/jam
    def __init__(self, width, height, display):
        self.width = width
        self.height = height
        self.display = display

        self.SCROLL_X = 400
        self.SCROLL_Y = 200
        self.x = self.y = 0

        self.FLOOR_Y_LEVEL = 380
        self.MAX_X = 5000
        self.MAX_Y = 5000

        self.slow_time = -1

        self.all_sprites = pygame.sprite.Group()
        self.all_game_objects = pygame.sprite.Group()
        self.background = pygame.sprite.Group()
        self.platforms = pygame.sprite.Group()
        self.characters = pygame.sprite.Group()
        self.projectiles = pygame.sprite.Group()
        self.foreground = pygame.sprite.Group()

        self.layers_list = [
            self.all_sprites, self.background, self.projectiles,
            self.platforms, self.characters, self.foreground
        ]

        self.collide_with_player = pygame.sprite.Group()

        self.clock = pygame.time.Clock()

        self.player_character = Player(50, self.FLOOR_Y_LEVEL - 50, self)
        self.player_character.add(self.all_sprites, self.all_game_objects,
                                  self.characters)

        self.initialize_level()

        #texte = "Je crois que les filles m'aiment bien parceque je suis un peu mystérieux comme Light Yagami, je suis toujours tout seul, aux récrées je m’assoie sur un banc avec ma capuche et la tête baissé et quand quelque passe à coté de moi je chuchote des truc genre okamari no suzoki, ça ne veut rien dire mais ça fait mystique, les gens sont intrigués."
        texte = "Voix dans votre tête : Bonjour. Vous vous réveiller soudainement dans un laboratoire. Vous n’avez rien sur vous, mais soudain vous avez une envie incontrôlable de voler toutes les pièces. <ENTRER>| | (Pour vous déplacer vous pouvez utiliser les flèches du clavier, et la touche espace vous permet de ralentir le temps.) |Bonne chance"
        self.ui = Ui(self.display, self.width, self.height, 499, 190, 300, 400,
                     texte, self)
        self.ui.add(self.all_sprites, self.foreground)

        self.game_song_slow = pygame.mixer.Sound("assets/music1.wav")
        self.game_song = pygame.mixer.Sound("assets/music0.wav")
        self.music()
        self.score = 0

        self.fond_image = pygame.transform.scale(
            pygame.image.load("assets/fond.png"), (800, 350)).convert_alpha()

        self.game_over_image = pygame.transform.scale(
            pygame.image.load("assets/gameover.png"), (800, 600)).convert()
        self.game_victoire_image = pygame.transform.scale(
            pygame.image.load("assets/victory.png"), (800, 600)).convert()
示例#16
0
    def __init__(self):
        # Call parent constructor
        super().__init__()

        # Set Window Title and Size
        self.title('Easy Deploy')
        self.geometry('300x700')

        # Initialize UI and set it to variable for
        # easy property access.
        Ui(self)
示例#17
0
 def __init__(self):
     self.ui = Ui()
     self.notify = cache.Notify()
     self.datatype = 'songs'
     self.popen_handler = None
     # flag stop, prevent thread start
     self.playing_flag = False
     self.pause_flag = False
     self.songs = []
     self.idx = 0
     self.volume = 60
     self.show_lrc = True
示例#18
0
def run_game():

    # Initialize pygame, settings, and screen object.
    pygame.init()
    pygame.mixer.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode(
        (ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("Hell")
    # Set the games frame rate
    clock = pygame.time.Clock()
    #set up the sound channels
    channel1 = pygame.mixer.Channel(0)
    channel2 = pygame.mixer.Channel(1)
    shot = pygame.mixer.Sound('sounds/ship_shot.wav')
    hit = pygame.mixer.Sound('sounds/ship_hit.wav')
    boss_hit = pygame.mixer.Sound('sounds/boss_hit.wav')
    # Make a counter for the timed attackes
    ai_counter = 0
    # Make the Play button
    play_button = Button(ai_settings, screen, "Start")
    # Make a ship and group of bullets and a group of boss bullets
    ship = Ship(ai_settings, screen)
    bullets = Group()
    boss_bullets = Group()
    # Make a boss.
    boss = Boss(ai_settings, screen)
    # Create an instance to store game statistics and the ui
    stats = GameStats(ai_settings)
    ui = Ui(ai_settings, screen, stats)
    # Start the main loop for the game.
    while True:
        gf.check_events(ai_settings, screen, stats, play_button, ship, bullets,
                        shot)

        if stats.game_active and ai_settings.boss_health > 0:
            if ai_settings.boss_health == 700 and not ship.second_stage:
                gf.start_stage2(ai_settings, boss, ship)
            clock.tick(60)
            ai_counter = gf.update_counter(ai_counter)
            gf.update_boss_ai(ai_settings, screen, boss, boss_bullets,
                              ai_counter, ship)
            ship.update()
            gf.update_bullets(ai_settings, screen, ship, boss, bullets,
                              boss_hit)
            gf.update_boss(ai_settings, ai_counter, screen, ship, boss,
                           bullets)
            gf.update_boss_bullets(ai_settings, stats, screen, ship, boss,
                                   bullets, boss_bullets, hit)

        gf.update_screen(ai_settings, screen, stats, ship, boss, boss_bullets,
                         bullets, play_button, ui)
示例#19
0
文件: player.py 项目: wolf9s/musicbox
 def __init__(self):
     self.config = Config()
     self.ui = Ui()
     self.popen_handler = None
     # flag stop, prevent thread start
     self.playing_flag = False
     self.pause_flag = False
     self.process_length = 0
     self.process_location = 0
     self.process_first = False
     self.storage = Storage()
     self.info = self.storage.database["player_info"]
     self.songs = self.storage.database["songs"]
     self.playing_id = -1
     self.cache = Cache()
     self.mpg123_parameters = self.config.get_item("mpg123_parameters")
示例#20
0
 def __init__(self):
     reload(sys)
     sys.setdefaultencoding('utf8')
     self.const = util.Constant()
     self.datalist = ['搜索歌曲', '搜索艺术家']
     self.datatype = 'main'
     self.lib = Library()
     self.offset = 0
     self.page = 0
     self.player = vlc.VLC()
     self.START = time.time()
     self.step = 10
     self.title = 'KANraoke'
     self.screen = curses.initscr()
     self.ui = Ui()
     signal.signal(signal.SIGWINCH, self.change_term)
     signal.signal(signal.SIGINT, self.send_kill)
示例#21
0
def run_app():

    set = Settings()
    set.load() 

    # init app
    app = QApplication(sys.argv)
    engine = QQmlApplicationEngine()

    clip = app.clipboard()

    # connect QML and python
    ui = Ui(clip, engine.rootContext(), set)

    # setup and load QML
    engine.load(pyinstaller.resource_path(os.path.join("ui", "main.qml")))
    app.setWindowIcon(QIcon(pyinstaller.resource_path(os.path.join("icons", "icon.ico"))))

    sys.exit(app.exec_())
示例#22
0
 def __init__(self):
     self.config = Config()
     self.ui = Ui()
     self.popen_handler = None
     # flag stop, prevent thread start
     self.playing_flag = False
     self.pause_flag = False
     self.process_length = 0
     self.process_location = 0
     self.process_first = False
     self.storage = Storage()
     self.info = self.storage.database['player_info']
     self.songs = self.storage.database['songs']
     self.playing_id = -1
     self.cache = Cache()
     self.notifier = self.config.get_item('notifier')
     self.mpg123_parameters = self.config.get_item('mpg123_parameters')
     self.end_callback = None
     self.playing_song_changed_callback = None
示例#23
0
def main() -> None:
    s = Settings()

    if s.display_output:
        win = Ui(s)
    else:
        win = None

    if s.verbose:
        print("Setup done, verbose is active")

    cap = Video(s)
    cap.detect_objects(s)
    while True:
        # cap.detect_objects(s)
        cap.update_live_feed(s)
        if s.autodetect:
            cap.detect_objects(s)

        # cv.imwrite('./frame.bmp', cap.frame)

        if s.display_output:
            status_code = win.update(s, cap)
            if status_code == 2:
                if s.verbose:
                    print("Started new detection")
                cap.detect_objects(s)
            elif status_code == 3:
                win.del_extra_window()
            elif status_code != 0:
                break
            if win.update_detect:
                cap.detect_objects(s)
                win.update_detect = False
        else:
            cap.detect_objects(s)

    s.update_json()
    if s.display_output:
        del win
    del s
    del cap
示例#24
0
def main():
    in_file = 'vilnius.png'
    db = Database('data.sqlite')

    window_width = gtk.gdk.screen_width()
    window_height = gtk.gdk.screen_height()

    window = MapWindow(in_file, int(window_width * 0.8),
                       int(window_height * 0.8), "Route finder")
    route = Route(window.get_max_distance(), db)

    run_program = True
    while run_program and cv.getWindowProperty(window.WINDOW_NAME, 0) >= 0:
        cv.waitKey(1)
        ui = Ui(db, window, route)
        if ui.get_exit():
            run_program = False

    cv.destroyAllWindows()
    db.conn.close()
示例#25
0
def main():
    USER_ID = '31ytkldamhg43ewe6yaspk3lzhvu'
    play_token = None
    read_token = None
    current_token = None
    try:
        read_token = util.prompt_for_user_token(USER_ID, 'user-library-read')
        play_token = util.prompt_for_user_token(USER_ID,
                                                'user-modify-playback-state')
        current_token = util.prompt_for_user_token(
            USER_ID, 'user-read-currently-playing')
    except (AttributeError):
        os.remove(f".cache-{USER_ID}")
        read_token = util.prompt_for_user_token(USER_ID, 'user-library-read')
        play_token = util.prompt_for_user_token(USER_ID,
                                                'user-modify-playback-state')
        current_token = util.prompt_for_user_token(
            USER_ID, 'user-read-currently-playing')

    sp_read = spotipy.Spotify(auth=read_token)
    sp_play = spotipy.Spotify(auth=play_token)
    sp_current = spotipy.Spotify(auth=current_token)

    #Get artists albums dictionary

    current_user_albums_artist(sp_read)
    #Get artist_id
    artists = list(artist_id_to_artist.values())
    artists_readable = [a.__str__() for a in artists]

    mp = SpotifyMusicPlayer(sp_read, sp_play, sp_current, artists)

    p = Ui(mp)
    p.draw_ui()
    loop = urwid.MainLoop(p.player_ui_frame,
                          palette=[('reversed', 'standout', '')],
                          unhandled_input=p.handle_keys)
    loop.set_alarm_in(2, p.update_albums_box)
    loop.run()
示例#26
0
    def __init__(self):
        self.main_window = QtWidgets.QMainWindow()
        self.ui = Ui(self.main_window)
        self.visEngine = None

        self.pat_dict = self.import_data("patient_database", Patient)
        self.rad_dict = self.import_data("radiologist_database", Doctor)
        self.sur_dict = self.import_data("surgeon_database", Doctor)

        # self.export_data("patient_database", self.pat_dict)
        # self.export_data("radiologist_database", self.rad_dict)
        # self.export_data("surgeon_database", self.sur_dict)

        self.current_pat_id = None
        self.current_errand_id = None
        self.current_rad_id = None
        self.current_sur_id = None
        self.current_theme_button_pressed = self.ui.menu_bar_theme_button_night_mode

        self.pat_initialized = False
        self.rad_initialized = False
        self.sur_initialized = False
        self.setup_functionality()
示例#27
0
from ui import Ui
from controller import Controller
from repo import Repo

repo = Repo()
controller = Controller(repo)
c = Ui(controller)
c.run()
示例#28
0
import sys

from PyQt5 import QtWidgets
from ui import Ui

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    window = Ui()
    window.show()
    app.exec_()
示例#29
0
def create_game(context):
    context.user_interface = Ui()
    context.game = Game(context.user_interface)
示例#30
0
from computer import Computer
from game import Game
from ui import Ui
from board import Board
from gui import Gui

computer = Computer()
board = Board()
game = Game(board, computer)
ui = Ui(game)
gui = Gui(game)
gui.start()