예제 #1
0
 def __init__(self):
     Globals.INTRO_SOUND_PLAYED = False
     if Globals.PLAYER_NAME is None:
         Globals.PLAYER_NAME = ""
     self.error_message = None
     self.loader = AssetLoader('images')
     self.setup_text()
     self.show_extra = False
     self.extra_time = 0
     Globals.play_menu_sound()
예제 #2
0
 def change_value(self, factor=1):
     if self.selected == 0:
         self.volume_slider.change_value(
             SettingsState.SLIDER_DELTA * factor)
         Globals.set_volume(self.volume_slider.value)
     elif self.selected == 1:
         self.brightness_slider.change_value(
             SettingsState.SLIDER_DELTA * factor)
         Globals.set_brightness(SettingsState.MIN_BRIGHTNESS +
                                self.brightness_slider.value)
예제 #3
0
 def change_value(self, factor=1):
     if self.selected == 0:
         self.volume_slider.change_value(SettingsState.SLIDER_DELTA *
                                         factor)
         Globals.set_volume(self.volume_slider.value)
     elif self.selected == 1:
         self.brightness_slider.change_value(SettingsState.SLIDER_DELTA *
                                             factor)
         Globals.set_brightness(SettingsState.MIN_BRIGHTNESS +
                                self.brightness_slider.value)
예제 #4
0
파일: Game.py 프로젝트: elanas/TheCrazySix
 def initialize(self):
     pygame.init()
     Globals.WIDTH = 1000
     Globals.HEIGHT = 600
     Globals.SCREEN = pygame.display.set_mode(
         (Globals.WIDTH, Globals.HEIGHT))
     SettingsManager.load()
     Globals.set_brightness(SettingsManager.BRIGHTNESS, save=False)
     Globals.set_volume(SettingsManager.VOLUME, save=False)
     pygame.display.set_caption('The Crazy Six - Field Day')
     Globals.STATE = Title()
     Globals.EVENT_MANAGER = EventManager()
예제 #5
0
파일: Game.py 프로젝트: elanas/TheCrazySix
 def initialize(self):
     pygame.init()
     Globals.WIDTH = 1000
     Globals.HEIGHT = 600
     Globals.SCREEN = pygame.display.set_mode(
         (Globals.WIDTH, Globals.HEIGHT))
     SettingsManager.load()
     Globals.set_brightness(SettingsManager.BRIGHTNESS, save=False)
     Globals.set_volume(SettingsManager.VOLUME, save=False)
     pygame.display.set_caption('The Crazy Six - Field Day')
     Globals.STATE = Title()
     Globals.EVENT_MANAGER = EventManager()
예제 #6
0
 def __init__(self):
     self.loader = AssetLoader('images')
     self.background_img = self.loader.load_image('background.png')
     Globals.play_menu_sound()
     self.title_surf = self.loader.load_image_alpha(
         SettingsState.TITLE_IMAGE_PATH)
     self.title_rect = self.title_surf.get_rect()
     self.title_rect.centerx = Globals.WIDTH / 2
     self.title_rect.top = SettingsState.TITLE_MARGIN_TOP
     self.control_index = 0
     self.init_labels()
     self.init_sliders()
     self.selected = 0
예제 #7
0
 def __init__(self):
     Globals.INTRO_SOUND_PLAYED = False
     self.file_name = ""
     self.error_message = None
     self.loader = AssetLoader('images')
     self.setup_text()
     self.show_extra = False
     self.extra_time = 0
     Globals.play_menu_sound()
     self.background_img = self.loader.load_image('background.png')
     self.file_manager = FileManager(
         path=CustomLevelNameInput.CUSTOM_MAP_PATH,
         file_ext=CustomLevelNameInput.MAP_FILE_EXT)
예제 #8
0
파일: Level.py 프로젝트: elanas/TheCrazySix
 def got_current_state(self):
     diff = self.camera.initView()
     self.shift_non_player_objects(diff[0], diff[1])
     self.player.rect.center = Globals.SCREEN.get_rect().center
     if self.should_fade_in:
         self.start_fade_in()
     if self.has_timer and self.timer is None:
         self.timer = ScoreTimer()
     elif self.timer is not None:
         self.timer.unpause()
     Globals.stop_menu_sound()
     self.start_music()
     self.first_occur = False
예제 #9
0
 def __init__(self):
     self.loader = AssetLoader('images')
     self.background_img = self.loader.load_image('background.png')
     Globals.play_menu_sound()
     self.title_surf = self.loader.load_image_alpha(
         SettingsState.TITLE_IMAGE_PATH)
     self.title_rect = self.title_surf.get_rect()
     self.title_rect.centerx = Globals.WIDTH / 2
     self.title_rect.top = SettingsState.TITLE_MARGIN_TOP
     self.control_index = 0
     self.init_labels()
     self.init_sliders()
     self.selected = 0
예제 #10
0
 def got_current_state(self):
     diff = self.camera.initView()
     self.shift_non_player_objects(diff[0], diff[1])
     self.player.rect.center = Globals.SCREEN.get_rect().center
     if self.should_fade_in:
         self.start_fade_in()
     if self.has_timer and self.timer is None:
         self.timer = ScoreTimer()
     elif self.timer is not None:
         self.timer.unpause()
     Globals.stop_menu_sound()
     self.start_music()
     self.first_occur = False
예제 #11
0
 def __init__(self):
     self.init_images()
     self.file_manager = FileManager(
         path=CustomLevelPicker.CUSTOM_MAP_PATH,
         file_ext=CustomLevelPicker.MAP_FILE_EXT)
     self.file_names = self.file_manager.get_files(strip_ext=True)
     self.current_selection = 0
     self.text_surf = None
     self.text_rect = None
     self.highlight_surf = None
     self.highlight_rect = None
     self.build_text()
     self.build_subtitles()
     Globals.play_menu_sound()
예제 #12
0
 def __init__(self):
     self.init_images()
     self.file_manager = FileManager(
         path=CustomLevelPicker.CUSTOM_MAP_PATH,
         file_ext=CustomLevelPicker.MAP_FILE_EXT)
     self.file_names = self.file_manager.get_files(strip_ext=True)
     self.current_selection = 0
     self.text_surf = None
     self.text_rect = None
     self.highlight_surf = None
     self.highlight_rect = None
     self.build_text()
     self.build_subtitles()
     Globals.play_menu_sound()
예제 #13
0
파일: DBMS.py 프로젝트: aldemirenes/TextDB
    def select(self, field, data):
 	if not isinstance(field, basestring) or not isinstance(data, basestring):
 	    return {"err": "You cannot do that", "result": None}

        args_list = [Globals()._Select,
                     self.db_name,
                     field, 
                     data]
        process = SUBPopen(args_list, stdout=SUBPIPE, stderr=SUBPIPE)
        stdout, stderr = process.communicate()
        if stderr:
            return {"err": stderr, "result": stdout}

        if stdout in ["\n", ""]:
            return {"err": None, "result": stdout}
        else:
            result_splt = stdout.strip().split("\n")
            fields=result_splt.pop(0).split(" ")
            result_lst = []
            temp_dict = {}
            for j in range(len(result_splt)): 
                for i in range(len(fields)):
                    temp_dict[fields[i]] = result_splt[j].split(" ")[i]
                result_lst.append(temp_dict)

            return {"err":None, "result": result_lst}
예제 #14
0
    def initUI(self):
        mainLayout = QVBoxLayout()

        self.button1 = QPushButton("选择人事拆账表-印力")
        self.button1.clicked.connect(self.click_select_my1)
        self.button1.setMinimumHeight(70)

        self.button2 = QPushButton("选择人事拆账表-印铭")
        self.button2.clicked.connect(self.click_select_my2)
        self.button2.setMinimumHeight(70)

        self.button3 = QPushButton("选择部门编码表")
        self.button3.clicked.connect(self.click_select_refer)
        self.button3.setMinimumHeight(70)

        time_str = Globals.get_time_text_str()
        self.label = QLineEdit(time_str)
        self.label.setPlaceholderText("输入凭证日期 如2018/11/6...")
        self.label.setMinimumHeight(50)

        self.button4 = QPushButton("开始处理")
        self.button4.clicked.connect(self.click_judge_btn)
        self.button4.setMinimumHeight(70)

        self.text_browser = QTextBrowser()

        mainLayout.addWidget(self.label)
        mainLayout.addWidget(self.button1)
        mainLayout.addWidget(self.button2)
        mainLayout.addWidget(self.button3)
        mainLayout.addWidget(self.button4)

        mainLayout.addWidget(self.text_browser)

        # data
        self.my_filename1 = "C:\\Users\\pangjm\\Desktop\\1.xls"  #""
        self.my_filename2 = "C:\\Users\\pangjm\\Desktop\\2.xlsx"  #""
        self.refer_filename = "C:\\Users\\pangjm\\Desktop\\部门.xlsx"  #""

        self.output_dir = Globals.desktop_path + "工资社保公积金\\"
        self.out_put_filename1 = Globals.desktop_path + "工资社保公积金\\工资社保公积金汇总.xlsx"

        self.out_put_filename2 = Globals.desktop_path + "工资社保公积金\\结转工资.xlsx"
        self.out_put_filename3 = Globals.desktop_path + "工资社保公积金\\结转公积金.xlsx"
        self.out_put_filename4 = Globals.desktop_path + "工资社保公积金\\结转社保.xlsx"
        self.out_put_filename5 = Globals.desktop_path + "工资社保公积金\\预提工资.xlsx"
        self.out_put_filename6 = Globals.desktop_path + "工资社保公积金\\预提社保.xlsx"

        self.refer_data = None
        self.my_data = None

        self.setLayout(mainLayout)
        self.setWindowTitle("工资社保公积金")
        self.setGeometry(550, 150, 900, 800)
        self.show()

        if not Globals.user:
            self.close()
예제 #15
0
파일: Game.py 프로젝트: jgnation/pytetris
    def checkForFullRow(self, background, occupied_blocks, screen, piece):
        #check occupied_blocks for full row
        block_positions = piece.getCurrentCoordinates()
        #min_position is the top of the highest sub_block in the piece that was just placed
        min_position = min([x['y'] for x in block_positions])

        y = Globals.screen_height
        while y >= min_position:  #todo: >= here?

            if len([x for x in occupied_blocks if x['y'] == y]) == 10:
                self.rows_eliminated += 1
                self.to_next_level += 1
                if self.to_next_level >= 10:
                    self.time_delay -= 20
                    self.to_next_level = 0
                    self.level += 1
                #at this point a row has been filled and I need to delete it
                occupied_blocks[:] = [
                    x for x in occupied_blocks if x['y'] != y
                ]  #using a slice to modify list in place
                #now move the blocks ABOVE the deleted row down a notch
                for block in occupied_blocks:
                    if block['y'] < y: block['y'] += Globals.block_height

                #the items have been deleted from occupied_blocks....now redraw everything
                background.fill(self.game_screen_color)
                screen.blit(background, (0, 0))
                for block in occupied_blocks:
                    Globals.drawBlock(screen, block['color'], block)
                self.level_label = self.font.render(
                    "Level: " + str(self.level), 1, (255, 255, 255))
                self.rows_eliminated_label = self.font.render(
                    "Rows Eliminated: " + str(self.rows_eliminated), 1,
                    (255, 255, 255))
                self.window_screen.fill((0, 0, 0))
                self.window_screen.blit(self.level_label, (450, 80))
                self.window_screen.blit(self.rows_eliminated_label, (450, 100))
                self.window_screen.blit(screen, (self.game_screen_start_x, 0))
                pygame.display.update(
                )  #update this during the loop to give the effect of removing rows one at a time
                background = screen.copy()
                pygame.time.delay(250)
            else:
                y -= Globals.block_height
        return background
예제 #16
0
 def write_pre_labels(self):
     '''
     This loads all of the song names in the song directory
     and creates a csv called pre_labels where each song will be 
     manually labeled. the resulting file should be saved as labels.csv 
     INPUT: NONE
     OUTPUT: NONE
     '''
     song_dir = Globals.getSongDir()
     file_list = [f for f in listdir(song_dir) if isfile(join(song_dir, f))]
     read_count = 0
     song_names = []
     for file_name in file_list:
         if ".wav" not in file_name:
             break
         read_count += 1
         song_names.append(file_name)
     self.write_pre_labels_to_csv(song_names, Globals.getLabelsDir())
예제 #17
0
 def __init__(self, return_state, escape_state=None):
     self.return_state = return_state
     self.escape_state = escape_state if escape_state is not None else \
         Menu.Menu()
     self.loader = AssetLoader('images')
     self.background_img = self.loader.load_image('background.png')
     self.pause_image = self.loader.load_image_alpha('game-paused.png')
     Globals.play_menu_sound()
     # self.title_surf = PauseScreen.TITLE_FONT.render(
     #     PauseScreen.TITLE_TEXT, True, PauseScreen.TITLE_COLOR)
     # self.title_rect = self.title_surf.get_rect()
     # self.title_rect.center = Globals.SCREEN.get_rect().center
     self.black_surf = pygame.Surface(
         (Globals.WIDTH, Globals.HEIGHT)).convert()
     self.black_surf.fill((0, 0, 0))
     self.fade_in = False
     self.fade_out = False
     self.alpha_factor = 300
     self.start_fade_in()
예제 #18
0
 def get_recording(self, file_name):
     '''
     This reads the song's wave data into recording, which gets returned
     INPUT: file_name = string, name of wav file
     OUTPUT: recording = 2d numpy float array of song data in time domain;
     sample_rate = float, sampling rate of song
     '''
     song_name = Globals.getSongDir() + "\\" + file_name
     sample_rate, recording = wavfile.read(song_name)
     return sample_rate, recording
예제 #19
0
 def get_recording(self, file_name):
     '''
     This reads the song's wave data into recording, which gets returned
     INPUT: file_name = string, name of wav file
     OUTPUT: recording = 2d numpy float array of song data in time domain;
     sample_rate = float, sampling rate of song
     '''
     song_name = Globals.getSongDir() + "\\" + file_name
     sample_rate, recording = wavfile.read(song_name)
     return sample_rate, recording
예제 #20
0
파일: Utils.py 프로젝트: ajayal/AOSCompiler
    def ViewConfig(self):
        def btn(obj):
            Globals().CDial(
                gtk.MESSAGE_INFO, "Configuration removed",
                "Your configuration has been removed. Please restart the application to re-configure."
            )

        dialog = gtk.Dialog("Cmcompiler", None,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        dialog.set_size_request(600, 400)
        dialog.set_resizable(False)
        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.show()
        table = gtk.Table(1, 1, False)
        table.show()
        sw.add_with_viewport(table)
        frame = gtk.Frame()
        frame.add(sw)
        frame_label = gtk.Label()
        frame_label.set_markup("Configuration:")
        frame_label.show()
        frame.set_label_widget(frame_label)
        frame.set_border_width(15)
        frame.show()
        dialog.vbox.pack_start(frame, True, True, 0)

        try:
            f = open(Globals.myCONF)
            count = 0
            for line in f:
                if "Cmc" in line:
                    pass
                elif line == '\n':
                    pass
                else:
                    count += 1
                    i = line.split("=")
                    x = i[0]
                    y = i[1]
                    label = gtk.Label()
                    label.set_markup("<b>%s:</b> <small>%s</small>" % (x, y))
                    label.show()
                    label.set_alignment(xalign=0, yalign=0)
                    label.set_padding(5, 5)
                    table.attach(label, 0, 1, count - 1, count)
        except IOError:
            Globals().CDial(
                gtk.MESSAGE_ERROR, "Failed reading configuration",
                "Can't currently read the config file.\n\nIs it open somewhere else?\n\nPlease try again."
            )

        dialog.run()
        dialog.destroy()
예제 #21
0
파일: DBMS.py 프로젝트: aldemirenes/TextDB
    def deleteDatabase(self):
        args_list = [Globals()._DeleteDatabase,
                     self.db_name]
        process = SUBPopen(args_list, stdout=SUBPIPE, stderr=SUBPIPE)
        stdout, stderr = process.communicate()
        if stderr:
            return {"err": stderr, "result": None}

        if stdout in ["\n", ""]:
            return {"err": None, "result": "OK"}
        else:
            return {"err": stderr, "result": stdout}
예제 #22
0
 def getSongLabels(self):
     '''
     This is used externally to get all of 
     the song labels after the songs have been labeled.  It returns 
     the dictionary of song labels
     INPUT: NONE
     OUTPUT: dictionary, keys = song names, values = song labels
     '''
     df = pd.read_csv(Globals.getLabelsDir()+"\\"+"labels.csv")
     return dict(df.values)    
         
     
예제 #23
0
파일: DBMS.py 프로젝트: aldemirenes/TextDB
 def __init__(self, db_name, data_dict):
     self.db_name = db_name
     self.data_dict = data_dict
     self.data_str = ""
     self.key_str = ""
     if len(data_dict) != 0 or data_dict != {}:
         self.data_str = " ".join([str(data_dict[x]) for x in data_dict])
         self.key_str = " ".join([str(x) for x in data_dict])
     if not ISFILE(Globals().DBPATH + "/" + self.db_name + ".db"):
         self.create_db()
         self.create_sch()
     return
예제 #24
0
파일: DBMS.py 프로젝트: aldemirenes/TextDB
    def add(self):
        args_list = [Globals()._Add, 
                    self.db_name,
                    self.data_str]
        process = SUBPopen(args_list, stdout=SUBPIPE, stderr=SUBPIPE)
        stdout, stderr = process.communicate()
        if stderr:
            return {"err": stderr, "result": stdout}

        if stdout in ["\n", ""]:
            return {"err": None, "result": "OK"}
        else:
            return {"err": stderr, "result": stdout}
예제 #25
0
    def __init__(self):
        GameState.__init__(self)
        self.size = HowToPlay.INIT_SIZE
        self.delta = 1
        self.time_delta = 0
        self.font = pygame.font.Font(None, self.size)
        self.alpha_factor = 300

        # self.title_surf = self.font.render(TITLE, True, TITLE_COLOR)
        # self.title_rect = self.title_surf.get_rect()
        # self.title_rect.centerx = Globals.SCREEN.get_rect().centerx
        # self.title_rect.top = Globals.SCREEN.get_rect().top + TITLE_PADDING

        self.alt_surf = HowToPlay.ALT_FONT.render(HowToPlay.ALT_TITLE, True,
                                                  HowToPlay.ALT_COLOR)
        self.alt_rect = self.alt_surf.get_rect()
        self.alt_rect.centerx = Globals.SCREEN.get_rect().centerx
        self.alt_rect.centery = HowToPlay.MAX_DELTA + \
            HowToPlay.ALT_PADDING

        self.init_subtitle()
        Globals.play_menu_sound()
예제 #26
0
    def deal_jiezhuangongzi_data(self, target_file_name):
        excel_data = Globals.get_origin_excel_data()

        origin_data = self.my_data["工资"]
        refer_data = self.refer_data

        for i in range(1, len(origin_data)):
            origin_row = origin_data[i]

            target_rows = []
            #if origin_row[self.get_gongzi_idx("求和项:1、应付工资")]:
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            #if origin_row[self.get_gongzi_idx("求和项:1、应付工资")]:
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))

            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))

            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))

            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            target_rows.append(deepcopy(Globals.pingzheng_demo))
            for row in target_rows:
                row[Globals.get_pingzheng_idx("摘要")] = origin_row[
                    self.get_gongzi_idx("成本部门")]
                row[Globals.get_pingzheng_idx("记账日期")] = self.label.text()
                row[Globals.get_pingzheng_idx("业务日期")] = self.label.text()
                excel_data["凭证"].append(row)

        self.save_data(target_file_name, excel_data)
예제 #27
0
    def __init__(self):
        GameState.__init__(self)
        self.size = HowToPlay.INIT_SIZE
        self.delta = 1
        self.time_delta = 0
        self.font = pygame.font.Font(None, self.size)
        self.alpha_factor = 300

        # self.title_surf = self.font.render(TITLE, True, TITLE_COLOR)
        # self.title_rect = self.title_surf.get_rect()
        # self.title_rect.centerx = Globals.SCREEN.get_rect().centerx
        # self.title_rect.top = Globals.SCREEN.get_rect().top + TITLE_PADDING

        self.alt_surf = HowToPlay.ALT_FONT.render(HowToPlay.ALT_TITLE, True,
                                                  HowToPlay.ALT_COLOR)
        self.alt_rect = self.alt_surf.get_rect()
        self.alt_rect.centerx = Globals.SCREEN.get_rect().centerx
        self.alt_rect.centery = HowToPlay.MAX_DELTA + \
            HowToPlay.ALT_PADDING

        self.init_subtitle()
        Globals.play_menu_sound()
예제 #28
0
파일: Game.py 프로젝트: jgnation/pytetris
    def checkForFullRow(self, background, occupied_blocks, screen, piece):
        #check occupied_blocks for full row
        block_positions = piece.getCurrentCoordinates()
        #min_position is the top of the highest sub_block in the piece that was just placed
        min_position = min([x['y'] for x in block_positions])

        y = Globals.screen_height
        while y >= min_position: #todo: >= here?

            if len([x for x in occupied_blocks if x['y'] == y]) == 10:
                self.rows_eliminated += 1
                self.to_next_level += 1
                if self.to_next_level >= 10:
                    self.time_delay -= 20
                    self.to_next_level = 0
                    self.level += 1
                #at this point a row has been filled and I need to delete it
                occupied_blocks[:] = [x for x in occupied_blocks if x['y'] != y] #using a slice to modify list in place
                #now move the blocks ABOVE the deleted row down a notch
                for block in occupied_blocks:
                    if block['y'] < y: block['y'] += Globals.block_height

                #the items have been deleted from occupied_blocks....now redraw everything
                background.fill(self.game_screen_color)
                screen.blit(background, (0,0))
                for block in occupied_blocks:
                    Globals.drawBlock(screen, block['color'], block)
                self.level_label = self.font.render("Level: " + str(self.level), 1, (255,255,255))
                self.rows_eliminated_label = self.font.render("Rows Eliminated: " + str(self.rows_eliminated), 1, (255,255,255))
                self.window_screen.fill((0,0,0))
                self.window_screen.blit(self.level_label, (450, 80))
                self.window_screen.blit(self.rows_eliminated_label, (450, 100))
                self.window_screen.blit(screen, (self.game_screen_start_x,0))
                pygame.display.update() #update this during the loop to give the effect of removing rows one at a time
                background = screen.copy()
                pygame.time.delay(250)
            else: y -= Globals.block_height
        return background
예제 #29
0
    def __init__(self):
        GameState.__init__(self)
        # self.size = Title.INIT_SIZE
        self.diff = 0
        self.delta = 1
        self.time_delta = 0
        # self.font = pygame.font.Font(None, self.size)
        # self.base_surf = self.font.render(GAME_TITLE, True, TITLE_COLOR)
        self.base_surf = TITLE_IMG
        self.base_size = self.base_surf.get_rect().size
        # Title.INIT_SIZE = self.base_size[1]
        self.widthrat = self.base_size[0] / self.base_size[1]
        self.title_surf = self.base_surf
        self.title_rect = self.title_surf.get_rect()
        self.title_rect.centerx = Globals.SCREEN.get_rect().centerx
        self.title_rect.centery = Globals.SCREEN.get_rect().centery

        self.alt_surf = Title.ALT_FONT.render(Title.ALT_TITLE, True,
                                              Title.ALT_COLOR)
        self.alt_rect = self.alt_surf.get_rect()
        self.alt_rect.centerx = Globals.SCREEN.get_rect().centerx
        self.alt_rect.centery = self.title_rect.bottom + Title.MAX_DELTA + \
            Title.ALT_PADDING
        Globals.play_menu_sound()
예제 #30
0
 def delete_files(self):
     '''
     This function deletes all waveform data .csv 
     when convert_all is run
     NO INPUTS OR OUTPUTS
     '''
     folder = Globals.getCsvDir()
     for the_file in os.listdir(folder):
         file_path = os.path.join(folder, the_file)
         try:
             if os.path.isfile(file_path):
                 os.unlink(file_path)
         except Exception, e:
             print e
             raise
예제 #31
0
 def delete_files(self):
     '''
     This function deletes all waveform data .csv 
     when convert_all is run
     NO INPUTS OR OUTPUTS
     '''
     folder = Globals.getCsvDir()
     for the_file in os.listdir(folder):
         file_path = os.path.join(folder, the_file)
         try:
             if os.path.isfile(file_path):
                 os.unlink(file_path)
         except Exception, e:
             print e
             raise    
예제 #32
0
파일: DBMS.py 프로젝트: aldemirenes/TextDB
    def delete(self, field, data):
 	if not isinstance(field, basestring) or not isinstance(data, basestring):
 	    return {"err": "You cannot do that", "result": None}
        args_list = [Globals()._Delete,
                     self.db_name,
                     field,
                     data]
        process = SUBPopen(args_list, stdout=SUBPIPE, stderr=SUBPIPE)
        stdout, stderr = process.communicate()
        if stderr:
            return {"err": stderr, "result": None}

        if stdout in ["\n", ""]:
            return {"err": None, "result": "OK"}
        else:
            return {"err": stderr, "result": stdout}
예제 #33
0
파일: DBMS.py 프로젝트: aldemirenes/TextDB
    def update(self, field, data, update_dict):
        temp_dict = [k+":"+v for k, v in update_dict.iteritems()]        
        args_list = [Globals()._Update,
                     self.db_name,
                     field,
                     data,
                     ] + temp_dict
        process = SUBPopen(args_list, stdout=SUBPIPE, stderr=SUBPIPE)
        stdout, stderr = process.communicate()
        if stderr:
            return {"err": stderr, "result": None}

        if stdout in ["\n", ""]:
            return {"err": None, "result": "OK"}
        else:
            return {"err": stderr, "result": None}
예제 #34
0
    def initUI(self):
        mainLayout = QVBoxLayout()

        self.button1 = QPushButton("选择古北当月银行流水")
        self.button1.clicked.connect(self.click_select_my)
        self.button1.setMinimumHeight(70)

        self.button2 = QPushButton("选择EAS编码基础信息表")
        self.button2.clicked.connect(self.click_select_refer)
        self.button2.setMinimumHeight(70)

        time_str = Globals.get_time_text_str()
        self.label = QLineEdit(time_str)
        self.label.setPlaceholderText("输入凭证日期 如2018/11/6...")
        self.label.setMinimumHeight(50)

        self.button3 = QPushButton("开始处理")
        self.button3.clicked.connect(self.click_judge_btn)
        self.button3.setMinimumHeight(70)

        self.text_browser = QTextBrowser()

        mainLayout.addWidget(self.button1)
        # mainLayout.addWidget(self.button2)
        mainLayout.addWidget(self.label)
        mainLayout.addWidget(self.button3)

        mainLayout.addWidget(self.text_browser)

        # data
        self.my_filename = None  # "C:\\Users\\pangjm\\Desktop\\源.csv" #""
        # self.out_put_filename2 = "C:\\Users\\pangjm\\Desktop\\收到云pos汇总表.xlsx"
        self.out_put_filename = Globals.desktop_path + "停车场支付宝返款.xlsx"
        self.out_put_filename1 = Globals.desktop_path + "停车场微信返款.xlsx"
        self.refer_filename = ""
        self.refer_data = None
        self.my_data = None

        self.setLayout(mainLayout)
        self.setWindowTitle("停车场支付宝返款")
        self.setGeometry(550, 150, 900, 800)
        self.show()

        if not Globals.user:
            self.close()
예제 #35
0
	def initUI(self):
		mainLayout = QVBoxLayout()

		self.button1 = QPushButton("选择地产表:标准凭证引出-GX凭证类型")
		self.button1.clicked.connect(self.click_select_my)
		self.button1.setMinimumHeight(70)

		self.button2 = QPushButton("选择基础信息表")
		self.button2.clicked.connect(self.click_select_bank)
		self.button2.setMinimumHeight(70)

		time_str = Globals.get_time_text_str()
		self.label = QLineEdit(time_str)
		self.label.setPlaceholderText("输入凭证日期 如2018/11/6...")
		self.label.setMinimumHeight(50)
		
		self.button3 = QPushButton("开始处理")
		self.button3.clicked.connect(self.click_judge_btn)
		self.button3.setMinimumHeight(70)

		self.text_browser = QTextBrowser()

		mainLayout.addWidget(self.button1)
		mainLayout.addWidget(self.button2)
		mainLayout.addWidget(self.label)
		mainLayout.addWidget(self.button3)

		mainLayout.addWidget(self.text_browser)

		# data
		self.my_filename = None  # "C:\\Users\\pangjm\\Desktop\\共享导入\\10月导出.xls" #""
		self.bank_filename = None  # "C:\\Users\\pangjm\\Desktop\\共享导入\\共享凭证导入模板.xlsx" #""
		self.out_put_filename = Globals.desktop_path + "共享生成凭证.xlsx"
		self.my_data= None
		self.bank_data = None

		self.setLayout(mainLayout)
		self.setWindowTitle("共享导入")
		self.setGeometry(550, 150, 900, 800)
		self.show()

		if not Globals.user:
			self.close()
예제 #36
0
 def write_data_to_csv(self, song_data, song_name, genre, column_labels):
     '''
     This function writes the song's feature row data
     into a csv file for modeling
     INPUT: song_data = 1d numpy array of floats containing
     song feature data; song_name (string); genre (string);
     column_labels = 1d numpy array of strings, song feature labels
     OUTPUT: NONE
     '''
     csv_dir = Globals.getCsvDir()
     song_data = song_data.tolist()
     song_data.append(song_name)
     song_data.append(genre)
     column_names = [str(lab) for lab in column_labels]
     column_names.append("Song Name")
     column_names.append("Label")
     with open(csv_dir + "\\" + song_name + '.csv', 'wb') as csvfile:
         writer = csv.writer(csvfile, delimiter=',')
         writer.writerow(column_names)
         writer.writerow(song_data)
예제 #37
0
 def write_data_to_csv(self, song_data, song_name, genre, column_labels):
     '''
     This function writes the song's feature row data
     into a csv file for modeling
     INPUT: song_data = 1d numpy array of floats containing
     song feature data; song_name (string); genre (string);
     column_labels = 1d numpy array of strings, song feature labels
     OUTPUT: NONE
     ''' 
     csv_dir = Globals.getCsvDir()
     song_data = song_data.tolist()
     song_data.append(song_name)
     song_data.append(genre)
     column_names = [str(lab) for lab in column_labels]
     column_names.append("Song Name")
     column_names.append("Label")
     with open(csv_dir + "\\" + song_name + '.csv', 'wb') as csvfile:
         writer = csv.writer(csvfile, delimiter=',')
         writer.writerow(column_names)
         writer.writerow(song_data)
예제 #38
0
 def df_stitcher(self):
     dir = Globals.getCsvDir()
     '''
     This loads all of the outputted csv data from 
     convert_all into the pandas data frame for analysis.
     It returns just the pandas data frame
     INPUT: none
     OUTPUT: pandas data frame containing feature data
     '''
     '''
     this could also go into the Modeler file/class
     '''
     file_list = [f for f in listdir(dir) if isfile(join(dir, f))]
     df = pd.DataFrame()
     for file_name in file_list:
         try:
             df_dum = pd.read_csv(dir + "\\" + file_name)
         except:
             continue
         df = df.append(df_dum, ignore_index=True)
     df = df.dropna()
     return df
예제 #39
0
 def df_stitcher(self):
     dir = Globals.getCsvDir()
     '''
     This loads all of the outputted csv data from 
     convert_all into the pandas data frame for analysis.
     It returns just the pandas data frame
     INPUT: none
     OUTPUT: pandas data frame containing feature data
     '''
     '''
     this could also go into the Modeler file/class
     '''
     file_list = [f for f in listdir(dir) if isfile(join(dir, f))]
     df = pd.DataFrame()
     for file_name in file_list:
         try:
             df_dum = pd.read_csv(dir + "\\" + file_name)
         except:
             continue
         df = df.append(df_dum, ignore_index=True)
     df = df.dropna()
     return df
예제 #40
0
파일: Piece.py 프로젝트: jgnation/pytetris
 def draw(self, screen):
     for pair in self.block_coordinates:
         Globals.drawBlock(screen, self.color, pair)
     pygame.display.update()
예제 #41
0
 def handle_return(self):
     Globals.reset_game()
     Globals.goto_first_level()
예제 #42
0
 def handle_return(self):
     Globals.stop_menu_sound()
     self.start_fade_out()
예제 #43
0
    def create(self):
        """ Creates this pipeline """

        self.debug("Setting up render pipeline")

        if self.settings is None:
            self.error("You have to call loadSettings first!")
            return

        self.debug("Analyzing system ..")
        SystemAnalyzer.analyze()


        self.debug("Checking required Panda3D version ..")
        SystemAnalyzer.checkPandaVersionOutOfDate(7,8,2014)


        # Mount everything first
        self.mountManager.mount()

        # Store globals, as cython can't handle them
        self.debug("Setting up globals")
        Globals.load(self.showbase)
        Globals.font = loader.loadFont("Data/Font/SourceSansPro-Semibold.otf")
        Globals.font.setPixelsPerUnit(25)

        # Setting up shader loading
        BetterShader._DumpShaders = self.settings.dumpGeneratedShaders

        # We use PTA's for shader inputs, because that's faster than
        # using setShaderInput
        self.temporalProjXOffs = PTAInt.emptyArray(1)
        self.cameraPosition = PTAVecBase3f.emptyArray(1)
        self.motionBlurFactor = PTAFloat.emptyArray(1)
        self.lastMVP = PTALMatrix4f.emptyArray(1)
        self.currentMVP = PTALMatrix4f.emptyArray(1)
        self.currentShiftIndex = PTAInt.emptyArray(1)

        # Initialize variables
        self.camera = self.showbase.cam
        self.size = self._getSize()
        self.cullBounds = None

        # For the temporal reprojection it is important that the window width
        # is a multiple of 2
        if self.settings.enableTemporalReprojection and self.size.x % 2 == 1:
            self.error(
                "The window has to have a width which is a multiple of 2 "
                "(Current: ", self.showbase.win.getXSize(), ")")
            self.error(
                "I'll correct that for you, but next time pass the correct "
                "window size!")

            wp = WindowProperties()
            wp.setSize(
                self.showbase.win.getXSize() + 1, self.showbase.win.getYSize())
            self.showbase.win.requestProperties(wp)
            self.showbase.graphicsEngine.openWindows()

            # Get new size
            self.size = self._getSize()

        # Debug variables to disable specific features
        self.haveLightingPass = True

        # haveCombiner can only be true when haveLightingPass is enabled
        self.haveCombiner = True
        self.haveMRT = True

        # Not as good as I want it, so disabled. I'll work on it.
        self.blurEnabled = False

        self.debug("Window size is", self.size.x, "x", self.size.y)

        self.showbase.camLens.setNearFar(0.1, 50000)
        self.showbase.camLens.setFov(115)

        self.showbase.win.setClearColor(Vec4(1.0, 0.0, 1.0, 1.0))

        # Create GI handleer
        if self.settings.enableGlobalIllumination:
            self._setupGlobalIllumination()

        # Create occlusion handler
        self._setupOcclusion()

        if self.settings.displayOnscreenDebugger:
            self.guiManager = PipelineGuiManager(self)
            self.guiManager.setup()

        # Generate auto-configuration for shaders
        self._generateShaderConfiguration()

        # Create light manager, which handles lighting + shadows
        if self.haveLightingPass:
            self.lightManager = LightManager(self)

        self.patchSize = LVecBase2i(
            self.settings.computePatchSizeX,
            self.settings.computePatchSizeY)

        # Create separate scene graphs. The deferred graph is render
        self.forwardScene = NodePath("Forward-Rendering")
        self.transparencyScene = NodePath("Transparency-Rendering")
        self.transparencyScene.setBin("transparent", 30)

        # We need no transparency (we store other information in the alpha
        # channel)
        self.showbase.render.setAttrib(
            TransparencyAttrib.make(TransparencyAttrib.MNone), 100)

        # Now create deferred render buffers
        self._makeDeferredTargets()

        # Create the target which constructs the view-space normals and
        # position from world-space position
        if self.occlusion.requiresViewSpacePosNrm():
            self._createNormalPrecomputeBuffer()

        # Setup the buffers for lighting
        self._createLightingPipeline()

        # Setup combiner for temporal reprojetion
        if self.haveCombiner and self.settings.enableTemporalReprojection:
            self._createCombiner()

        if self.occlusion.requiresBlurring():
            self._createOcclusionBlurBuffer()

        self._setupAntialiasing()

        if self.blurEnabled:
            self._createDofStorage()
            self._createBlurBuffer()

        # Not sure why it has to be 0.25. But that leads to the best result
        aspect = float(self.size.y) / self.size.x
        self.onePixelShift = Vec2(
            0.125 / self.size.x, 0.125 / self.size.y / aspect) * self.settings.jitterAmount

        # Annoying that Vec2 has no multliply-operator for non-floats
        multiplyVec2 = lambda a, b: Vec2(a.x*b.x, a.y*b.y)

        if self.antialias.requiresJittering():
            self.pixelShifts = [
                multiplyVec2(self.onePixelShift, Vec2(-0.25,  0.25)),
                multiplyVec2(self.onePixelShift, Vec2(0.25, -0.25))
            ]
        else:
            self.pixelShifts = [Vec2(0), Vec2(0)]
        self.currentPixelShift = PTAVecBase2f.emptyArray(1)
        self.lastPixelShift = PTAVecBase2f.emptyArray(1)

        self._setupFinalPass()
        self._setShaderInputs()

        # add update task
        self._attachUpdateTask()
예제 #44
0
파일: Level.py 프로젝트: elanas/TheCrazySix
 def handle_go_back(self):
     if Globals.goto_previous_level():
         self.stop_music()
         self.timer.pause()
         self.player.stop_and_set_direction(Character.INDEX_UP)
예제 #45
0
 def handle_action_key(self):
     Globals.stop_menu_sound()
     self.start_fade_out()
예제 #46
0
 def got_state_back(self):
     Globals.goto_previous_level()
예제 #47
0
파일: Level.py 프로젝트: elanas/TheCrazySix
 def render_overlay(self):
     if Globals.DISORIENTED:
         Globals.SCREEN.blit(Globals.get_disoriented_surf(), (0, 0),
                             special_flags=pygame.BLEND_SUB)
예제 #48
0
    def deal_zhifubao_data(self):
        target_excel = {"凭证": []}
        target_data = target_excel["凭证"]
        row1 = [
            "公司",
            "记账日期",
            "业务日期",
            "会计期间",
            "凭证类型",
            "凭证号",
            "分录号",
            "摘要",
            "科目",
            "币种",
            "汇率",
            "方向",
            "原币金额",
            "数量",
            "单价",
            "借方金额",
            "贷方金额",
            "制单人",
            "过账人",
            "审核人",
            "附件数量",
            "过账标记",
            "机制凭证模块",
            "删除标记",
            "凭证序号",
            "单位",
            "参考信息",
            "是否有现金流量",
            "现金流量标记",
            "业务编号",
            "结算方式",
            "结算号",
            "辅助账摘要",
            "核算项目1",
            "编码1",
            "名称1",
            "核算项目2",
            "编码2",
            "名称2",
            "核算项目3",
            "编码3",
            "名称3",
            "核算项目4",
            "编码4",
            "名称4",
            "核算项目5",
            "编码5",
            "名称5",
            "核算项目6",
            "编码6",
            "名称6",
            "核算项目7",
            "编码7",
            "名称7",
            "核算项目8",
            "编码8",
            "名称8",
            "发票号",
            "换票证号",
            "客户",
            "费用类别",
            "收款人",
            "物料",
            "财务组织",
            "供应商",
            "辅助账业务日期",
            "到期日",
        ]
        target_data.append(row1)
        row2 = [
            "公司", "记账日期", "会计期间", "凭证类型", "凭证号", "币种", "分录号", "对方分录号", "主表信息",
            "附表信息", "原币", "本位币", "报告币", "主表金额系数", "附表金额系数", "性质", "核算项目1",
            "编码1", "名称1", "核算项目2", "编码2", "名称2", "核算项目3", "编码3", "名称3",
            "核算项目4", "编码4", "名称4", "核算项目5", "编码5", "名称5", "核算项目6", "编码6",
            "名称6", "核算项目7", "编码7", "名称7", "核算项目8", "编码8", "名称8"
        ]
        target_excel["现金流量"] = [row2]
        refer_data = self.refer_data
        bank_data = self.my_data

        target_rows = []
        row_num = len(bank_data) - 1

        date_str = self.label.text()
        month = date_str.split('/')[1]
        last_month = int(month) - 2
        if last_month == 0:
            last_month = 12
        elif last_month == -1:
            last_month = 11
        if last_month < 10:
            last_month = "0" + str(last_month)
        else:
            last_month = str(last_month)

        year = date_str.split('/')[0]
        day = date_str.split('/')[2]
        # 替换信息
        # replace_dict = self.get_replace_dict()
        # 银行凭证号
        #pingzhenghao_bank_idx = bank_data[0].index("凭证号")
        # 原币金额索引
        #yuanbijine_bank_idx = bank_data[0].index("原币金额")
        # 核算项目索引
        #hesuanxiangmu_bank_idx = bank_data[0].index("核算项目")
        # 贷方金额
        daifangjine_bank_idx = bank_data[0].index("贷方发生额")
        # 摘要
        zhaiyao_bank_idx = bank_data[0].index("摘要")
        # 交易时间
        jiaoyitime_bank_idx = bank_data[0].index("交易时间")

        for i in range(row_num):
            idx = i + 1
            row = []
            row2 = []
            target_rows.append(row)
            # target_rows.append(row2)
            # 公司
            row.append("E018")
            row2.append("E018")
            # 记账日期
            row.append(date_str)
            row2.append(date_str)
            # 业务日期
            row.append(date_str)
            row2.append(date_str)
            # 会计期间
            row.append(int(month))
            row2.append(int(month))
            # 凭证类型
            row.append("收")
            row2.append("收")
            # 凭证号
            row.append("20181100963")
            row2.append("20181100963")
            # 分录号
            row.append(idx)
            row2.append(idx * 2)
            # 摘要
            jiaoyitime_str = bank_data[idx][jiaoyitime_bank_idx].split()[0]
            middle_str = "收到 微信一点停支付宝返款-"
            zhiayao_str = bank_data[idx][zhaiyao_bank_idx]
            zhaiyao_value = jiaoyitime_str + middle_str + zhiayao_str
            row.append(zhaiyao_value)
            row2.append("")
            # 科目
            row.append("1002.01")
            row2.append("1002.01")
            # 币种
            row.append("BB01")
            row2.append("BB01")
            # 汇率
            row.append(1)
            row2.append(1)
            # 方向
            row.append(1)
            row2.append(0)
            # 原币金额
            money_str = bank_data[idx][daifangjine_bank_idx].replace(",", "")
            curr_money = float(money_str)
            row.append(curr_money)
            row2.append(curr_money)
            # sum = sum + int(curr_money * 100)
            # 数量
            row.append(0)
            row2.append(0)
            # 单价
            row.append(0)
            row2.append(0)
            # 借方金额
            row.append(curr_money)
            row2.append("")
            # 贷方金额
            row.append("")
            row2.append("")
            # 制单人
            row.append(Globals.eas_name)
            row2.append(Globals.eas_name)
            # 过账人
            row.append("")
            row2.append("")
            # 审核人
            row.append("")
            row2.append("")
            # 附件数量
            row.append(1)
            row2.append(1)
            # 过账标记
            row.append("TRUE")
            row2.append("TRUE")
            # 机制凭证
            row.append("")
            row2.append("")
            # 删除标记
            row.append("FALSE")
            row2.append("FALSE")
            # 凭证序号
            row.append("1544876875657--0")
            row2.append("1544876875657--0")
            # 单位
            row.append("")
            row2.append("")
            # 参考信息
            row.append("")
            row2.append("")
            # 是否有现金流量
            row.append("")
            row2.append("")
            # 现金流量标记
            row.append(6)
            row2.append(6)
            # 业务编号
            row.append("")
            row2.append("")
            # 结算方式
            row.append("")
            row2.append("")
            # 结算号
            row.append("")
            row2.append("")
            # 辅助账摘要
            row.append(zhaiyao_value)
            row2.append("")
            # 核算项目1
            row.append("银行账户")
            row2.append("")
            # 编码1
            row.append("001.E018")
            row2.append("")
            # 名称1
            row.append("工商银行古北新区支行1001282509300071274")
            row2.append("")
            # 核算项目2
            row.append("现金流量项目")
            row2.append("")
            # 编码2
            row.append("111")
            row2.append("")
            # 名称2
            row.append("出租业务所收到的现金")
            row2.append("")

            # 项目3
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            # 项目4
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            # 项目5
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            # 项目6
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            # 项目7
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            # 项目8
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            row.append("")
            row2.append("")
            # 发票号
            row.append("")
            row2.append("")
            # 换票证号
            row.append("")
            row2.append("")
            # 客户
            row.append("")
            row2.append("")
            # 费用类别
            row.append("")
            row2.append("")
            # 收款人
            row.append("")
            row2.append("")
            # 物料
            row.append("")
            row2.append("")
            # 财务组织
            row.append("")
            row2.append("")
            # 供应商
            row.append("")
            row2.append("")
            # 辅助帐业务日期
            row.append(date_str)
            row2.append("")
            # 到期日
            row.append("")
            row2.append("")

        for row in target_rows:
            target_data.append(row)

        # 处理结算的
        last_row = deepcopy(target_data[-1])
        title_row = target_data[0]
        jine_idx = title_row.index("原币金额")
        sum = 0
        for i in range(row_num):
            idx = i + 1
            row = target_data[idx]
            sum = sum + float(row[jine_idx])

        last_row[title_row.index("摘要")] = "收到 上海七宝万科停车场停车费-支付宝返款"
        last_row[title_row.index("科目")] = "1122.99"
        last_row[title_row.index("方向")] = "0"
        last_row[title_row.index("原币金额")] = float("%.2f" % (sum))
        last_row[title_row.index("借方金额")] = ""
        last_row[title_row.index("贷方金额")] = float("%.2f" % (sum))
        last_row[title_row.index("辅助账摘要")] = "收到 上海七宝万科停车场停车费-支付宝返款"
        last_row[title_row.index("核算项目1")] = "客户"
        last_row[title_row.index("编码1")] = "0503.E018"
        last_row[title_row.index("分录号")] = len(target_data)
        idx = title_row.index("名称1")
        last_row[idx] = "微信一点停"
        last_row[idx + 1] = ""
        last_row[idx + 2] = ""
        last_row[idx + 3] = ""
        target_data.append(last_row)
        save_data(self.out_put_filename, target_excel)
        # 处理日期
        Globals.eval_date_format(self.out_put_filename, ["B", "C", "BN"])
    def create(self):
        """ Creates the pipeline """

        self.debug("Setting up render pipeline")

        # Handy shortcuts
        self.showbase.accept("r", self.reloadShaders)
        self.showbase.accept("f7", self.createBugReport)

        if self.settings is None:
            self.error("You have to call loadSettings first!")
            return

        self.debug("Checking required Panda3D version ..")
        SystemAnalyzer.checkPandaVersionOutOfDate(29,04,2015)

        # Mount everything first
        self.mountManager.mount()

        # Check if there is already another instance running, but only if specified
        # in the settings
        if self.settings.preventMultipleInstances and not self.mountManager.getLock():
            self.fatal("Another instance of the rendering pipeline is already running")
            return

        # Store globals, as cython can't handle them
        self.debug("Setting up globals")
        Globals.load(self.showbase)
        Globals.font = loader.loadFont("Data/Font/SourceSansPro-Semibold.otf")
        Globals.font.setPixelsPerUnit(25)

        self._size = LVecBase2i(self.showbase.win.getXSize(), self.showbase.win.getYSize())

        # Check size
        if self._size.x % 2 == 1:
            self.fatal(
                "The window width has to be a multiple of 2 "
                "(Current: ", self._size.x, ")")
            return

        if self.settings.displayOnscreenDebugger:
            self.guiManager = PipelineGuiManager(self)
        else:
            self.guiManager = None

        # Some basic scene settings
        self.showbase.camLens.setNearFar(0.1, 500000)
        self.showbase.camLens.setFov(110)
        self.showbase.win.setClearColor(Vec4(1.0, 0.0, 1.0, 1.0))
        self.showbase.camNode.setCameraMask(self.getMainPassBitmask())
        self.showbase.render.setAttrib(TransparencyAttrib.make(TransparencyAttrib.MNone), 100)

        # Create render pass matcher
        self.renderPassManager = RenderPassManager()


        self._precomputeScattering()

        # Add initial pass
        self.initialRenderPass = InitialRenderPass()
        self.renderPassManager.registerPass(self.initialRenderPass)

        # Add deferred pass
        self.deferredScenePass = DeferredScenePass()
        self.renderPassManager.registerPass(self.deferredScenePass)

        # Add lighting pass
        self.lightingPass = LightingPass()
        self.renderPassManager.registerPass(self.lightingPass)

        # Add dynamic exposure pass
        if self.settings.useAdaptiveBrightness:
            self.dynamicExposurePass = DynamicExposurePass(self)
            self.renderPassManager.registerPass(self.dynamicExposurePass)

        # Add SSLR pass
        if self.settings.enableSSLR:
            self.sslrPass = SSLRPass()
            self.renderPassManager.registerPass(self.sslrPass)

        # Add volumetric lighting
        # self.volumetricLightingPass = VolumetricLightingPass()
        # self.renderPassManager.registerPass(self.volumetricLightingPass)

        # Add final pass
        self.finalPostprocessPass = FinalPostprocessPass()
        self.renderPassManager.registerPass(self.finalPostprocessPass)

        # Create managers
        self.occlusionManager = AmbientOcclusionManager(self)
        self.lightManager = LightManager(self)
        self.antialiasingManager = AntialiasingManager(self)
        self.dynamicObjectsManager = DynamicObjectsManager(self)
        
        if self.settings.useTransparency:
            self.transparencyManager = TransparencyManager(self)
        else:
            self.transparencyManager = None


        self._createGlobalIllum()

        # Make variables available
        self._createGenericDefines()
        self._createInputHandles()
        self._createDefaultTextureInputs()
        self._createViewSpacePass()

        # Finally matchup all the render passes and set the shaders
        self.renderPassManager.createPasses()
        self.renderPassManager.writeAutoconfig()
        self.renderPassManager.setShaders()

        # Create the update tasks
        self._createTasks()

        # Create the effect loader
        self.effectLoader = EffectLoader(self)

        # Apply the default effect to the scene
        self.setEffect(Globals.render, "Effects/Default/Default.effect", {
            "transparent": False,
            "normalMapping": False,
            "alphaTest": True,

            }, -10)

        if self.settings.enableGlobalIllumination:
            self.globalIllum.reloadShader()

        # Give the gui a hint when the pipeline is done loading
        if self.guiManager:
            self.guiManager.onPipelineLoaded()

        self.reloadShaders()
    def create(self):
        """ Creates the pipeline """

        self.debug("Setting up render pipeline")

        self.guiVisible = True

        # Handy shortcuts
        self.showbase.accept("1", PStatClient.connect)
        self.showbase.accept("r", self.reloadShaders)
        self.showbase.accept("t", self.reloadEffects)
        self.showbase.accept("f7", self._createBugReport)
        self.showbase.accept("f8", self.toggleGui)


        if self.settings is None:
            self.error("You have to call loadSettings first!")
            return

        self.debug("Checking required Panda3D version ..")
        SystemAnalyzer.checkPandaVersionOutOfDate(12,8,2015)
        # SystemAnalyzer.analyze()

        # Mount everything first
        self.mountManager.mount()

        # Check if there is already another instance running, but only if specified
        # in the settings
        if self.settings.preventMultipleInstances and not self.mountManager.getLock():
            self.fatal("Another instance of the rendering pipeline is already running")
            return

        # Store globals, as cython can't handle them
        self.debug("Setting up globals")
        Globals.load(self.showbase)
            
        Globals.resolution = LVecBase2i( \
            int(self.showbase.win.getXSize() * self.settings.resolution3D),
            int(self.showbase.win.getYSize() * self.settings.resolution3D))

        Globals.font = loader.loadFont("Data/Font/SourceSansPro-Semibold.otf")
        Globals.font.setPixelsPerUnit(25)

        # Check size
        if Globals.resolution.x % 2 == 1:
            self.fatal(
                "The window width has to be a multiple of 2 "
                "(Current: ", Globals.resolution.x, ")")
            return

        if self.settings.displayOnscreenDebugger:
            self.guiManager = PipelineGuiManager(self)
        else:
            self.guiManager = None

        # Some basic scene settings
        self.showbase.camLens.setNearFar(0.1, 70000)
        self.showbase.camLens.setFov(110)
        self.showbase.win.setClearColor(Vec4(1.0, 0.0, 1.0, 1.0))
        self.showbase.camNode.setCameraMask(self.getMainPassBitmask())
        self.showbase.render.setAttrib(TransparencyAttrib.make(TransparencyAttrib.MNone), 100)

        # Create render pass matcher
        self.renderPassManager = RenderPassManager()

        # Create last frame buffers
        self._createLastFrameBuffers()

        self._precomputeScattering()

        # Add initial pass
        self.initialRenderPass = InitialRenderPass()
        self.renderPassManager.registerPass(self.initialRenderPass)

        # Add deferred pass
        self.deferredScenePass = DeferredScenePass(self)
        self.renderPassManager.registerPass(self.deferredScenePass)

        # Add lighting pass
        self.lightingPass = LightingPass()
        self.renderPassManager.registerPass(self.lightingPass)

        # Add dynamic exposure pass
        if self.settings.useAdaptiveBrightness:
            self.dynamicExposurePass = DynamicExposurePass(self)
            self.renderPassManager.registerPass(self.dynamicExposurePass)

        # Add motion blur pass
        if self.settings.enableMotionBlur:
            self.motionBlurPass = MotionBlurPass()
            self.renderPassManager.registerPass(self.motionBlurPass)

        # Add volumetric lighting
        # self.volumetricLightingPass = VolumetricLightingPass()
        # self.renderPassManager.registerPass(self.volumetricLightingPass)

        # Add bloom pass
        if self.settings.enableBloom:
            self.bloomPass = BloomPass()
            self.renderPassManager.registerPass(self.bloomPass)

        # Add dof pass
        if self.settings.enableDOF:
            self.dofPass = DOFPass()
            self.renderPassManager.registerPass(self.dofPass)


        # Add final pass
        self.finalPostprocessPass = FinalPostprocessPass()
        self.renderPassManager.registerPass(self.finalPostprocessPass)

        # Add scene finish pass
        self.sceneFinishPass = SceneFinishPass(self)
        self.renderPassManager.registerPass(self.sceneFinishPass)

        # Create managers
        self.occlusionManager = AmbientOcclusionManager(self)
        self.lightManager = LightManager(self)
        self.antialiasingManager = AntialiasingManager(self)
        self.dynamicObjectsManager = DynamicObjectsManager(self)
        self.sslrManager = SSLRManager(self)
        
        if self.settings.useTransparency:
            self.transparencyManager = TransparencyManager(self)

        if self.settings.enableClouds:
            self.cloudManager = CloudManager(self)

        self._createGlobalIllum()

        # Make variables available
        self._createGenericDefines()
        self._createInputHandles()
        self._createDefaultTextureInputs()
        self._createViewSpacePass()
        self._createSkyboxMaskPass()

        # Create an empty node at render space to store all dummmy cameras on
        camDummyNode = render.attachNewNode("RPCameraDummys")
        camDummyNode.hide()

        # Create an empty node at render space to store the light debug nodes
        lightDebugNode = render.attachNewNode("RPLightDebugNodes")

        # Finally matchup all the render passes and set the shaders
        self.renderPassManager.createPasses()
        self.renderPassManager.writeAutoconfig()
        self.renderPassManager.setShaders()

        # Create the update tasks
        self._createTasks()

        # Create the effect loader
        self.effectLoader = EffectLoader(self)

        # Apply the default effect to the scene
        self.setEffect(Globals.render, "Effects/Default/Default.effect", {
            "transparent": False,
            "normalMapping": True,
            "alphaTest": True,

            }, -10)

        render.setAttrib(AlphaTestAttrib.make(AlphaTestAttrib.MNone, 1), 999999)

        # Apply the debug effect to the light debug nodes
        self.setEffect(lightDebugNode, "Effects/LightDebug.effect", {
            "transparent": False,
            "normalMapping": False,
            "alphaTest": True,
            "castShadows": False,
            "castGI": False
        }, 100)

        self._setGuiShaders()

        if self.settings.enableGlobalIllumination:
            self.globalIllum.reloadShader()

        # Give the gui a hint when the pipeline is done loading
        if self.guiManager:
            self.guiManager.onPipelineLoaded()
    def create(self):
        """ Creates this pipeline """

        self.debug("Setting up render pipeline")

        if self.settings is None:
            self.error("You have to call loadSettings first!")
            return

        # Mount everything first
        self.mountManager.mount()

        # Store globals, as cython can't handle them
        self.debug("Setting up globals")
        Globals.load(self.showbase)

        # Setting up shader loading
        BetterShader._DumpShaders = self.settings.dumpGeneratedShaders

        # We use PTA's for shader inputs, because that's faster than
        # using setShaderInput
        self.temporalProjXOffs = PTAInt.emptyArray(1)
        self.cameraPosition = PTAVecBase3f.emptyArray(1)
        self.motionBlurFactor = PTAFloat.emptyArray(1)
        self.lastMVP = PTALMatrix4f.emptyArray(1)
        self.currentMVP = PTALMatrix4f.emptyArray(1)

        # Create onscreen gui

        # For the temporal reprojection it is important that the window width
        # is a multiple of 2
        if self.showbase.win.getXSize() % 2 == 1:
            self.error(
                "The window has to have a width which is a multiple of 2 "
                "(Current: ", self.showbase.win.getXSize(), ")")
            self.error(
                "I'll correct that for you, but next time pass the correct "
                "window size!")

            wp = WindowProperties()
            wp.setSize(
                self.showbase.win.getXSize() + 1, self.showbase.win.getYSize())
            self.showbase.win.requestProperties(wp)
            self.showbase.graphicsEngine.openWindows()



        self.camera = self.showbase.cam
        self.size = self._getSize()
        self.cullBounds = None

        # Debug variables to disable specific features
        self.haveLightingPass = True

        # haveCombiner can only be true when haveLightingPass is enabled
        self.haveCombiner = True
        self.haveMRT = True

        # Not as good as I want it, so disabled. I'll work on it.
        self.blurEnabled = False

        self.debug("Window size is", self.size.x, "x", self.size.y)

        self.showbase.camLens.setNearFar(0.1, 50000)
        self.showbase.camLens.setFov(90)


        self.showbase.win.setClearColor(Vec4(1.0,0.0,1.0,1.0))

        # Create occlusion handler
        self._setupOcclusion()

        if self.settings.displayOnscreenDebugger:
            self.guiManager = PipelineGuiManager(self)
            self.guiManager.setup()


        # Generate auto-configuration for shaders
        self._generateShaderConfiguration()


        # Create light manager, which handles lighting + shadows
        if self.haveLightingPass:
            self.lightManager = LightManager(self)

        self.patchSize = LVecBase2i(
            self.settings.computePatchSizeX,
            self.settings.computePatchSizeY)

        # Create separate scene graphs. The deferred graph is render
        self.forwardScene = NodePath("Forward-Rendering")
        self.transparencyScene = NodePath("Transparency-Rendering")

        # We need no transparency (we store other information in the alpha
        # channel)
        self.showbase.render.setAttrib(
            TransparencyAttrib.make(TransparencyAttrib.MNone), 100)

        # Now create deferred render buffers
        self._makeDeferredTargets()

        # Create the target which constructs the view-space normals and
        # position from world-space position
        if self.occlusion.requiresViewSpacePosNrm():
            self._createNormalPrecomputeBuffer()

        # Setup the buffers for lighting
        self._createLightingPipeline()

        # Setup combiner for temporal reprojetion
        if self.haveCombiner:
            self._createCombiner()

        if self.occlusion.requiresBlurring():
            self._createOcclusionBlurBuffer()

        self._setupAntialiasing()

        if self.blurEnabled:
            self._createDofStorage()
            self._createBlurBuffer()

        self._setupFinalPass()
        self._setShaderInputs()

        # add update task
        self._attachUpdateTask()
예제 #52
0
파일: Menu.py 프로젝트: elanas/TheCrazySix
 def __init__(self):
     GameState.__init__(self)
     self.color = pygame.color.Color("black")
     self.time = 0
     self.selection = 0
     Globals.play_menu_sound()
예제 #53
0
 def got_current_state(self):
     if not self.played_already:
         super(ZombieCutScene, self).got_current_state()
         self.played_already = True
     else:
         Globals.goto_next_level()
예제 #54
0
 def convert_all(self):
     '''
     This function can be thought of as the main, where all
     song wav data is converted. nothing is returned
     INPUT: NONE
     OUTPUT: NONE
     '''
     self.delete_files()
     song_dir = Globals.getSongDir()
     file_list = [f for f in listdir(song_dir) if isfile(join(song_dir, f))]
     read_count = 0
     incr = 1
     '''Begin conversion of all songs'''
     for file_name in file_list:
         if read_count > self.files_read_count:
             break
         if ".wav" not in file_name:
             break
         song_position = 1
         cycles = 0
         '''get the .wave recording using numpy functionality'''
         sample_rate, recording = self.get_recording(file_name)
         '''
         This while loop breaks only when the cycles condition 
         below is reached. the code allows for the song to be analyzed 
         in separate segments, but for now we just work with one segment
         as noted by the cycles > 0 termination condition.  
         the best way to solve this problem is to analyze the song as
         multiple segments, where each segment is individually listened 
         to by a human and classified manually.  This adds 
         a level of diversification to modeling songs.  I did not get 
         around to multiple song feature rows per song so here we
         just output one feature row per song for simplicity
         '''
         while 1==1:
             self.song_begin = float(song_position * 30)
             self.song_end = float(self.song_begin + 90)
             try:
                 '''split the song into .05 second segments'''
                 segments =\
                 self.get_segments_temporally(file_name, sample_rate, recording)
                 '''get all of the song's feature row data'''
                 song_data, column_labels = \
                 self.convert_one(file_name, self.segment_length, sample_rate, segments, recording)  
                 print file_name
             except Exception, e:
                 print e
                 break
             '''
             write one feature row for this part of the 
             song using write_data_to_csv
             '''
             '''
             ZULU6FOX6TROT is nothing but a delimiter 
             to ease splitting later on
             '''
             self.write_data_to_csv(song_data,\
             file_name.split(".wav")[0]+"ZULU6FOX6TROT" +str(int(self.song_begin))\
             + str(int(self.song_end)), self.labels[file_name], column_labels)
             song_position += incr
             cycles += 1
             if cycles > 0:
                 break 
         read_count += 1
예제 #55
0
 def btn(obj):
     Globals().CDial(
         gtk.MESSAGE_INFO, "Configuration removed",
         "Your configuration has been removed. Please restart the application to re-configure."
     )
예제 #56
0
파일: Level.py 프로젝트: elanas/TheCrazySix
 def handle_finish_fade_out(self):
     self.stop_music()
     if not Globals.goto_next_level():
         self.handle_last_level()