def __init__(self): image = resource_loader.loadImage("mainmenu_panel.png") self.cursor_image1 = resource_loader.loadImage("mainmenu_cursor1.png") self.cursor_image2 = resource_loader.loadImage("mainmenu_cursor2.png") gui.list.List.__init__(self, (image.get_size())) self.setBgImage(image) self.setMarginTop(20)
def init(): global window if window != None: return gui.res.register("shutdown_notselected", resource_loader.loadImage("shutdown_notselected.png")) gui.res.register("shutdown_selected", resource_loader.loadImage("shutdown_selected.png")) gui.res.register("font_shutdown_text", gui.res.font_system.getFont(20)) window = Window()
def __init__(self): self.image = resource_loader.loadImage("header.png") gui.Entity.__init__(self, self.image.get_size()) title_text = gui.res.string_inst_walbrix_install % wb_version if efi: title_text += "[EFI]" self.text = gui.res.font_header.render(title_text, True, (255, 255, 255)) self.joystick = resource_loader.loadImage( "icon_joystick_on.png" ) if gui.res.joystick != None else resource_loader.loadImage( "icon_joystick_off.png")
def init(): global window if window != None: return gui.res.register("mainmenu_panel", resource_loader.loadImage("mainmenu_panel.png")) gui.res.register("mainmenu_cursor1", resource_loader.loadImage("mainmenu_cursor1.png")) gui.res.register("mainmenu_cursor2", resource_loader.loadImage("mainmenu_cursor2.png")) gui.res.register("font_mainmenu", gui.res.font_system.getFont(18)) gui.res.register("font_mainmenu_small", gui.res.font_system.getFont(16)) window = MainMenu()
def init(): global window if window != None: return gui.res.register("header", resource_loader.loadImage("header.png")) gui.res.register("header_logo", resource_loader.loadImage("header_logo.png")) gui.res.register("icon_joystick_on", resource_loader.loadImage("icon_joystick_on.png")) gui.res.register("icon_joystick_off", resource_loader.loadImage("icon_joystick_off.png")) gui.res.register("icon_sound_on", resource_loader.loadImage("icon_sound_on.png")) gui.res.register("icon_sound_off", resource_loader.loadImage("icon_sound_off.png")) gui.res.register("icon_connected", resource_loader.loadImage("icon_connected.png")) gui.res.register("icon_disconnected", resource_loader.loadImage("icon_disconnected.png")) font = gui.res.font_system.getFont(16) for n in range(0, 10): digits.append(font.render(str(n), True, (255, 255, 255))) ymdcolonblank.append(font.render(u"年", True, (255, 255, 255))) ymdcolonblank.append(font.render(u"月", True, (255, 255, 255))) ymdcolonblank.append(font.render(u"日", True, (255, 255, 255))) ymdcolonblank.append(font.render(":", True, (255, 255, 255))) ymdcolonblank.append(pygame.Surface((ymdcolonblank[3].get_width(), 1), pygame.SRCALPHA, 32)) for n in range(0, 7): color = (255, 255, 255) if n == 5: color = (64, 64, 255) if n == 6: color = (255, 64, 64) weekday.append(font.render(u"(%s)" % weekdaystr[n], True, color)) window = Header()
def __init__(self, label, value="", bgcolor=None, min=1, max=32, acceptable_chars="0123456789abcdefghijklmnopqrstuvwxyz-_."): gui.EventHandler.__init__(self) self.keyboard = resource_loader.loadImage("keyboard.png") self.label = gui.Text(gui.res.font_messagebox) self.label.setText(label, TextInputBox.WIDTH) self.value = gui.EditText(gui.res.font_select_option, (96, 255, 96)) self.value.setText(value, TextInputBox.WIDTH) self.value.showCaret(True) self.value.setAcceptableChars(acceptable_chars) gui.Window.__init__( self, (TextInputBox.WIDTH + 10, self.label.getHeight() + self.value.getHeight() + 10 + 10 + self.keyboard.get_height())) self.bgcolor = bgcolor if bgcolor != None else gui.res.color_dialog_positive self.min = min self.max = max #self.available_chars = available_chars self.addChild("label", self.label, (5, 5)) self.addChild("value", self.value, (5, 5 + self.label.getHeight()))
def init(): global support support_l_filename = resource_loader.r({ "in": "support_l_in.png", "jp": "support_l_jp.png" }) support = resource_loader.loadImage(support_l_filename)
def init(): s = system.getSystem() uname = os.uname() global kernel_version, kernel_arch, kernel_date, ipaddress, cpus, cpu_clock, support_hvm, canvas, vpn_ipaddress kernel_version = uname[2] kernel_arch = s.getArchitectureString() kernel_date_str = uname[3].replace('Darwin Kernel ', '').split() kernel_date = gui.res.string_kernel_date % (kernel_date_str[7 if len(kernel_date_str) > 7 else 6],{"Jan":1,"Feb":2,"Mar":3,"Apr":4,"May":5,"Jun":6,"Jul":7,"Aug":8,"Sep":9,"Oct":10,"Nov":11,"Dec":12}[kernel_date_str[3]],kernel_date_str[4]) try: ipaddress = system.get_ip_address_which_reaches_default_gateway() except: pass # keep it None # CPU情報を得る xl_info = cli_info.run() cpus = xl_info.get("nr_cpus") or 0 cpu_clock = xl_info.get("cpu_mhz") or 0 xen_caps = xl_info.get("xen_caps") support_hvm = xen_caps is not None and "hvm-" in xen_caps canvas = pygame.Surface((400, 400), pygame.SRCALPHA, 32) vpn_ipaddress = None gui.res.register("status_panel", resource_loader.loadImage("status_panel.png")) gui.res.register("font_status_text", gui.res.font_system.getFont(18)) global window window = Window()
def init(): global window if window != None: return gui.res.register("font_marquee", gui.res.font_system.getFont(18)) gui.res.register("footer", resource_loader.loadImage("footer.png")) window = Footer()
def __init__(self, label, value = "", bgcolor = None, min = 1, max = 32, acceptable_chars = "0123456789abcdefghijklmnopqrstuvwxyz-_."): gui.EventHandler.__init__(self) self.keyboard = resource_loader.loadImage("keyboard.png") self.label = gui.Text(gui.res.font_messagebox) self.label.setText(label, TextInputBox.WIDTH) self.value = gui.EditText(gui.res.font_select_option, (96,255,96)) self.value.setText(value, TextInputBox.WIDTH) self.value.showCaret(True) self.value.setAcceptableChars(acceptable_chars) gui.Window.__init__(self, (TextInputBox.WIDTH + 10, self.label.getHeight() + self.value.getHeight() + 10 + 10 + self.keyboard.get_height())) self.bgcolor = bgcolor if bgcolor != None else gui.res.color_dialog_positive self.min = min self.max = max #self.available_chars = available_chars self.addChild("label", self.label, (5, 5)) self.addChild("value", self.value, (5, 5 + self.label.getHeight()))
def init(): global window if window != None: return gui.res.register("header", resource_loader.loadImage("header.png")) gui.res.register("header_logo", resource_loader.loadImage("header_logo.png")) gui.res.register("icon_joystick_on", resource_loader.loadImage("icon_joystick_on.png")) gui.res.register("icon_joystick_off", resource_loader.loadImage("icon_joystick_off.png")) gui.res.register("icon_sound_on", resource_loader.loadImage("icon_sound_on.png")) gui.res.register("icon_sound_off", resource_loader.loadImage("icon_sound_off.png")) gui.res.register("icon_connected", resource_loader.loadImage("icon_connected.png")) gui.res.register("icon_disconnected", resource_loader.loadImage("icon_disconnected.png")) font = gui.res.font_system.getFont(16) for n in range(0, 10): digits.append(font.render(str(n), True, (255, 255, 255))) ymdcolonblank.append(font.render(u"年", True, (255, 255, 255))) ymdcolonblank.append(font.render(u"月", True, (255, 255, 255))) ymdcolonblank.append(font.render(u"日", True, (255, 255, 255))) ymdcolonblank.append(font.render(":", True, (255, 255, 255))) ymdcolonblank.append( pygame.Surface((ymdcolonblank[3].get_width(), 1), pygame.SRCALPHA, 32)) for n in range(0, 7): color = (255, 255, 255) if n == 5: color = (64, 64, 255) if n == 6: color = (255, 64, 64) weekday.append(font.render(u"(%s)" % weekdaystr[n], True, color)) window = Header()
def init(): global support support_l_filename = resource_loader.r({ "in":"support_l_in.png", "jp":"support_l_jp.png"}) support = resource_loader.loadImage(support_l_filename)
def init(): s = system.getSystem() global hostname, version hostname = s.getHostname() version = system.version # 画像リソースのロード screen = gui.getScreen() global background, left_arrow, right_arrow, up_arrow, down_arrow, contents_color background = resource_loader.loadImage( ['background.jpg', 'background.png'], screen) gui.res.register("background", background) messagebox_buttons["ok"] = resource_loader.loadImage("button_ok.png") gui.res.register("button_ok", messagebox_buttons["ok"]) messagebox_buttons["cancel"] = resource_loader.loadImage( "button_cancel.png") gui.res.register("button_cancel", messagebox_buttons["cancel"]) left_arrow = resource_loader.loadImage("left.png") gui.res.register("left_arrow", left_arrow) right_arrow = resource_loader.loadImage("right.png") gui.res.register("right_arrow", right_arrow) up_arrow = resource_loader.loadImage("up.png") gui.res.register("list_up_arrow", up_arrow) down_arrow = resource_loader.loadImage("down.png") gui.res.register("list_down_arrow", down_arrow) gui.res.register("caution_sign", resource_loader.loadImage("caution_sign.png")) gui.res.register("icon_status", resource_loader.loadImage("icon_status.png")) gui.res.register("icon_volume", resource_loader.loadImage("icon_volume.png")) gui.res.register("icon_domain", resource_loader.loadImage("icon_domain.png")) gui.res.register("icon_app", resource_loader.loadImage("icon_app.png")) gui.res.register("icon_options", resource_loader.loadImage("icon_options.png")) gui.res.register("icon_console", resource_loader.loadImage("icon_console.png")) gui.res.register("icon_support", resource_loader.loadImage("icon_support.png")) gui.res.register("icon_back", resource_loader.loadImage("icon_back.png")) gui.res.register("icon_shutdown", resource_loader.loadImage("icon_shutdown.png")) gui.res.register("contents_panel", resource_loader.loadImage("contents_panel.png")) # フォントのロード global fontfile, font, smallfont, extrasmallfont fontfile_candidates = [ theme.getThemeFilePath("pfont.ttf"), "/System/Library/Fonts/ヒラギノ角ゴ ProN W3.otf", "/usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf", "/usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf" ] for fc in fontfile_candidates: if fc != None and os.path.exists(fc): fontfile = fc break gui.res.register("font_system", gui.FontFactory(fontfile)) font = gui.res.font_system.getFont(28) smallfont = gui.res.font_system.getFont(22) extrasmallfont = gui.res.font_system.getFont(16) gui.res.register("font_messagebox", font) gui.res.register("font_select_option", smallfont) gui.res.register("font_splash_message", font) gui.res.register("font_splash_serialno", smallfont) # 音声リソースのロード if sound_materials != None: sound_materials["click"] = resource_loader.loadSound("click.ogg") sound_materials["cancel"] = resource_loader.loadSound("cancel.ogg") sound_materials["fail"] = resource_loader.loadSound("fail.ogg") sound_materials["success"] = resource_loader.loadSound("success.ogg") # クロックの初期化 #global clock clock = pygame.time.Clock() gui.setClock(clock) # initialize dialog box subsystem dialogbox.init()
def main(): clock = gui.getClock() screen = gui.getScreen() title = resource_loader.loadImage("title.png") title_background = resource_loader.loadImage(("title_background.jpg", "title_background.png"), screen) copyright = resource_loader.loadImage("copyright.png") for y in range(1,100,10): clock.tick(60) screen.blit(title_background, title_background.get_rect()) rotitle = pygame.transform.rotozoom(title, 0, y / 100.0) screen.blit(rotitle, (320 - rotitle.get_width() / 2,200 - rotitle.get_height() / 2)) pygame.display.flip() for y in range(0, 120, 10): clock.tick(60) screen.blit(title_background, title_background.get_rect()) screen.blit(title, (320 - title.get_width() / 2, 200 - title.get_height() / 2)) screen.blit(copyright, (400, 510 - y)) pygame.display.flip() # シリアルナンバー表示 s = system.getSystem() hostname_txt = pygamehelper.render_font_with_shadow(gui.res.font_splash_serialno, u"SERIAL#: %s" % (s.getHostname()), (255, 255, 255)) screen.blit(hostname_txt, (16, 430)) pygame.display.flip() oldbg = screen.copy() count = 0 start_msg = pygamehelper.render_font_with_shadow(gui.res.font_splash_message, gui.res.string_enter_key_start, (255, 255, 255)) while True: clock.tick(8) event = pygame.event.poll() if gui.isSelectEvent(event): break if count == 0: screen.blit(start_msg, (screen.get_width() / 2 - start_msg.get_width() / 2, screen.get_height() * 2 / 3 - start_msg.get_height() / 2)) pygame.display.update() elif count == 6: screen.blit(oldbg, (0,0)) pygame.display.update() count += 1 if count > 11: count = 0 wbui.play_sound("click") background = resource_loader.loadImage(("background.jpg", "background.png"), screen) for alpha in reversed(range(0,255,32)): clock.tick(60) screen.blit(background, background.get_rect()) oldbg.set_alpha(alpha) screen.blit(oldbg, oldbg.get_rect()) pygame.display.flip() try: desktop = gui.DesktopWindow(screen.get_size()) gui.setDesktop(desktop) for i in (1,2,3): if try_auth(): return True else: gui.messagebox.execute(gui.res.string_incorrect_pass, ["ok"], gui.res.color_dialog_negative) finally: gui.setDesktop(None) return False
def init(): global _init_called if _init_called: return else: _init_called = True gui.res.register("window_lefttop", resource_loader.loadImage("window_lefttop.png")) gui.res.register("window_top", resource_loader.loadImage("window_top.png")) gui.res.register("window_righttop", resource_loader.loadImage("window_righttop.png")) gui.res.register("window_left", resource_loader.loadImage("window_left.png")) gui.res.register("window_right", resource_loader.loadImage("window_right.png")) gui.res.register("window_center", resource_loader.loadImage("window_center.png")) gui.res.register("window_leftbottom", resource_loader.loadImage("window_leftbottom.png")) gui.res.register("window_bottom", resource_loader.loadImage("window_bottom.png")) gui.res.register("window_rightbottom", resource_loader.loadImage("window_rightbottom.png")) gui.res.register("window_leftbottom2", resource_loader.loadImage("window_leftbottom2.png")) gui.res.register("window_bottom2", resource_loader.loadImage("window_bottom2.png")) gui.res.register("window_rightbottom2", resource_loader.loadImage("window_rightbottom2.png")) gui.res.register("dialog_button_selected", resource_loader.loadImage("dialog_button_selected.png")) gui.res.register("dialog_button_notselected", resource_loader.loadImage("dialog_button_notselected.png")) gui.res.register("icon_ok", resource_loader.loadImage("icon_ok.png")) gui.res.register("icon_cancel", resource_loader.loadImage("icon_cancel.png")) gui.res.register("keyboard", resource_loader.loadImage("keyboard.png")) gui.res.register("font_dialog_text", gui.res.font_system.getFont(18)) gui.res.register("font_dialog_button", gui.res.font_system.getFont(16))
def init(): global _init_called if _init_called: return else: _init_called = True gui.res.register("window_lefttop", resource_loader.loadImage("window_lefttop.png")) gui.res.register("window_top", resource_loader.loadImage("window_top.png")) gui.res.register("window_righttop", resource_loader.loadImage("window_righttop.png")) gui.res.register("window_left", resource_loader.loadImage("window_left.png")) gui.res.register("window_right", resource_loader.loadImage("window_right.png")) gui.res.register("window_center", resource_loader.loadImage("window_center.png")) gui.res.register("window_leftbottom", resource_loader.loadImage("window_leftbottom.png")) gui.res.register("window_bottom", resource_loader.loadImage("window_bottom.png")) gui.res.register("window_rightbottom", resource_loader.loadImage("window_rightbottom.png")) gui.res.register("window_leftbottom2", resource_loader.loadImage("window_leftbottom2.png")) gui.res.register("window_bottom2", resource_loader.loadImage("window_bottom2.png")) gui.res.register("window_rightbottom2", resource_loader.loadImage("window_rightbottom2.png")) gui.res.register("dialog_button_selected", resource_loader.loadImage("dialog_button_selected.png")) gui.res.register( "dialog_button_notselected", resource_loader.loadImage("dialog_button_notselected.png")) gui.res.register("icon_ok", resource_loader.loadImage("icon_ok.png")) gui.res.register("icon_cancel", resource_loader.loadImage("icon_cancel.png")) gui.res.register("keyboard", resource_loader.loadImage("keyboard.png")) gui.res.register("font_dialog_text", gui.res.font_system.getFont(18)) gui.res.register("font_dialog_button", gui.res.font_system.getFont(16))
gui.setClock(clock) gui.setFrameRate(30) fontfile_candidates = [ theme.getThemeFilePath("pfont.ttf"), "/System/Library/Fonts/ヒラギノ角ゴ ProN W3.otf", "/usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf" ] fontfile = next( itertools.ifilter(lambda x: x is not None and os.path.exists(x), fontfile_candidates), None) if fontfile == None: raise Exception("Font file doesn't exist") gui.res.register( "background", resource_loader.loadImage(["background.png", "background.jpg"], screen)) gui.res.register("button_ok", resource_loader.loadImage("button_ok.png")) gui.res.register("button_cancel", resource_loader.loadImage("button_cancel.png")) gui.res.register("list_up_arrow", resource_loader.loadImage("up.png")) gui.res.register("list_down_arrow", resource_loader.loadImage("down.png")) gui.res.register("contents_panel", resource_loader.loadImage("contents_panel.png")) gui.res.register("font_system", gui.FontFactory(fontfile)) gui.res.register("font_select_option", gui.res.font_system.getFont(22)) gui.res.register("font_messagebox", gui.res.font_system.getFont(28)) gui.res.register("font_mainmenu", gui.res.font_system.getFont(18)) gui.res.register("font_marquee", gui.res.font_mainmenu) gui.res.register("font_header", gui.res.font_mainmenu) gui.res.register("font_mainmenu_small", gui.res.font_system.getFont(16)) gui.res.register("icon_install",
def __init__(self): self.image = resource_loader.loadImage("footer.png") gui.Entity.__init__(self, self.image.get_size()) self.font = gui.res.font_marquee self.text = None self.start_time = None
def init(): s = system.getSystem() global hostname, version hostname = s.getHostname() version = system.version # 画像リソースのロード screen = gui.getScreen() global background, left_arrow, right_arrow, up_arrow, down_arrow, contents_color background = resource_loader.loadImage(['background.jpg','background.png'], screen) gui.res.register("background", background) messagebox_buttons["ok"] = resource_loader.loadImage("button_ok.png") gui.res.register("button_ok", messagebox_buttons["ok"]) messagebox_buttons["cancel"] = resource_loader.loadImage("button_cancel.png") gui.res.register("button_cancel", messagebox_buttons["cancel"]) left_arrow = resource_loader.loadImage("left.png") gui.res.register("left_arrow", left_arrow) right_arrow = resource_loader.loadImage("right.png") gui.res.register("right_arrow", right_arrow) up_arrow = resource_loader.loadImage("up.png") gui.res.register("list_up_arrow", up_arrow) down_arrow = resource_loader.loadImage("down.png") gui.res.register("list_down_arrow", down_arrow) gui.res.register("caution_sign", resource_loader.loadImage("caution_sign.png")) gui.res.register("icon_status", resource_loader.loadImage("icon_status.png")) gui.res.register("icon_volume", resource_loader.loadImage("icon_volume.png")) gui.res.register("icon_domain", resource_loader.loadImage("icon_domain.png")) gui.res.register("icon_app", resource_loader.loadImage("icon_app.png")) gui.res.register("icon_options", resource_loader.loadImage("icon_options.png")) gui.res.register("icon_console", resource_loader.loadImage("icon_console.png")) gui.res.register("icon_support", resource_loader.loadImage("icon_support.png")) gui.res.register("icon_back", resource_loader.loadImage("icon_back.png")) gui.res.register("icon_shutdown", resource_loader.loadImage("icon_shutdown.png")) gui.res.register("contents_panel", resource_loader.loadImage("contents_panel.png")) # フォントのロード global fontfile, font, smallfont, extrasmallfont fontfile_candidates = [ theme.getThemeFilePath("pfont.ttf"), "/System/Library/Fonts/ヒラギノ角ゴ ProN W3.otf", "/usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf", "/usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf"] for fc in fontfile_candidates: if fc != None and os.path.exists(fc): fontfile = fc break gui.res.register("font_system", gui.FontFactory(fontfile)) font = gui.res.font_system.getFont(28) smallfont = gui.res.font_system.getFont(22) extrasmallfont = gui.res.font_system.getFont(16) gui.res.register("font_messagebox", font) gui.res.register("font_select_option", smallfont) gui.res.register("font_splash_message", font) gui.res.register("font_splash_serialno", smallfont) # 音声リソースのロード if sound_materials != None: sound_materials["click"] = resource_loader.loadSound("click.ogg") sound_materials["cancel"] = resource_loader.loadSound("cancel.ogg") sound_materials["fail"] = resource_loader.loadSound("fail.ogg") sound_materials["success"] = resource_loader.loadSound("success.ogg") # クロックの初期化 #global clock clock = pygame.time.Clock() gui.setClock(clock) # initialize dialog box subsystem dialogbox.init()
def init(): global canvas, console console = resource_loader.loadImage('console_l.png')