Пример #1
0
    def __init__(self, parent, title, html):
        screen_width, screen_height = wx.GetDisplaySize()

        wx.Dialog.__init__(self,
                           parent,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           size=(min(screen_width * 0.6,
                                     1000), min(screen_height * 0.75, 703)),
                           title=title)
        sizer = wx.BoxSizer(wx.VERTICAL)

        browser = wx.html2.WebView.New(self)
        browser.SetPage(html, "")
        sizer.Add(browser, 1, wx.EXPAND, 10)

        close = wx.Button(self, -1, 'Close')
        close.Bind(wx.EVT_BUTTON, lambda event: self.EndModal(wx.OK))
        add_widget(sizer, close)

        self.SetSizer(sizer)

        def windows_accessibility_fix():
            robot = wx.UIActionSimulator()
            browser.SetFocus()
            position = browser.GetPosition()
            position = browser.ClientToScreen(position)
            robot.MouseMove(position)
            robot.MouseClick()

        doset_only(windows=windows_accessibility_fix)
Пример #2
0
def build_giants():
	check_platform()
	stuff = 'ZQuake, ZQCC, gamecode and Quake map tools'

	print('Building', stuff + '...')

	print('Compiling zquake')
	doset(
		mac=compile_zquake,
		windows=compile_zquake_windows)

	print('Compiling zqcc')
	doset(
		mac=compile_zqcc,
		windows=compile_zqcc_windows)

	print('Compiling gamecode')
	compile_gamecode()

	print('Renaming qutils files to lower-case')
	rename_qutils()

	print('Patching the Quake map tools')
	patch_map_tools_all()
	doset_only(windows=patch_map_tools_windows)

	print('Compiling the Quake map tools')
	doset(
		mac=compile_map_tools,
		windows=compile_map_tools_windows)

	print('Completed building', stuff + '.')
Пример #3
0
def launch_core(parent, method):
    if config.first_game_run():
        doset_only(windows=lambda: first_time_windows_prompt(parent))

    _update_oq_configs()

    launch_state = method()
    if launch_state is LaunchState.LAUNCHED:
        config.first_game_run(False)
    else:
        Error(parent, launch_messages[launch_state])
Пример #4
0
def build_audioquake():
    print('Building AudioQuake & Level Description Language',
          version_string + ': ' + release_name)

    check_platform()

    key_file_name = Build.dir_aq / 'key.py'
    if not key_file_name.exists():
        print('Generating a new key for date-of-birth validation')
        with open(key_file_name, 'w') as key_module:
            generated = uuid4().hex
            key_module.write(f"SECRET = '{generated}'\n")

    print('Converting manuals and single docs to HTML')
    prep_dir(Build.dir_manuals_converted)
    convert_manuals()  # TODO replace with a check if it needs doing

    print('Building AGRIP maps for Quake')
    build_maps_for(Build.dir_maps_quakewad, WADs.QUAKE)

    print('Building AGRIP maps for Open Quartz')
    build_maps_for(Build.dir_maps_freewad, WADs.FREE)

    print('Building AGRIP maps for high-contrast mode')
    build_maps_for(Build.dir_maps_prototypewad, WADs.PROTOTYPE)

    # Build the executables
    if not skip_pyinstaller:
        run_pyinstaller()
        copy_in_rcon()
        print('Creating distributable directory structure')
        make_collated_dir()
        move_app_to_collated_dir()
        doset_only(windows=windows_make_shortcut_to_app)
        if not args.skip_zip:
            print('Creating distributable archive')
            make_zip()

    if needed_quake_wad:
        print(
            '\nPlease note: the "quake.wad" file, containing id Software\'s '
            'Quake textures, is not present in the AudioQuake distributable '
            'directory. This means the AGRIP maps have not been built for '
            'Quake. That needs to happen in order to make a redistributable '
            'version of AudioQuake and the Level Description Language.\n\n'
            'You can make "quake.wad" by running AudioQuake directly from the '
            'distributable directory, and using the launcher\'s "Install '
            'registered Quake data" feature. Then re-run the build process, '
            'and the WAD file will be picked up, and the maps will be '
            'compiled.\n\n'
            'The "quake.wad" file itself should not be redistributed.')
Пример #5
0
def launch_core(parent, method):
    doset_only(windows=lambda: first_time_windows_firewall_info(parent))

    # FIXME: this should happen after registered check
    if not game_flickering_check(parent):
        return

    _update_oq_configs()

    launch_state = method()
    if launch_state is LaunchState.LAUNCHED:
        config.first_game_run(False)
    else:
        Error(parent, launch_messages[launch_state])
Пример #6
0
    def __init__(self, parent, title, game_controller):
        flags = wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)
        wx.Frame.__init__(self, parent, title=title, style=flags)

        sizer = wx.BoxSizer(wx.VERTICAL)

        notebook = doset(mac=lambda: wx.Notebook(self),
                         windows=lambda: wx.Listbook(self))

        tab_play = PlayTab(notebook, game_controller)
        tab_help = HelpTab(notebook)
        tab_customise = CustomiseTab(notebook, game_controller)
        tab_mod = ModTab(notebook, game_controller)
        tab_map = MapTab(notebook, game_controller)

        notebook.AddPage(tab_play, "Play")
        notebook.AddPage(tab_help, "Help")
        notebook.AddPage(tab_customise, "Customise")
        notebook.AddPage(tab_mod, "Mod")
        notebook.AddPage(tab_map, "Map")

        sizer.Add(notebook, 1, wx.EXPAND)
        sizer.SetSizeHints(self)  # doesn't seem to be needed?
        self.SetSizer(sizer)

        def set_up_menu_bar():
            menubar = wx.MenuBar()
            wx.MenuBar.MacSetCommonMenuBar(menubar)

        doset_only(mac=set_up_menu_bar)

        # TODO: If Quit on the Menu Bar is used and the engine is running, the
        # app gets the beachball until the engine is quat and then it quits.
        # Sounds like the only solution is to somehow quit Quake.
        def OnClose(event):
            if game_controller.quit():
                self.Destroy()
            else:
                if event.CanVeto():
                    event.Veto()
                    Warn(self, "Can't quit whilst Quake is still running.")
                else:
                    self.Destroy()  # has no effect as Quake still running

        self.Bind(wx.EVT_CLOSE, OnClose)
Пример #7
0
    def run(self):
        try:
            speaker = SpeechSynth()

            # The docs imply this shouldn't be necessary but it is...
            def reassign_commandline():
                self._command_line = ' '.join(
                    str(part) for part in self._command_line)

            doset_only(windows=reassign_commandline)

            # Buffering may be necessary for Windows; seems not to affect Mac
            proc = subprocess.Popen(self._command_line,
                                    bufsize=1,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)

            while True:
                retcode = proc.poll()
                line = proc.stdout.readline().rstrip().decode('ascii')

                length = len(line)
                if length > 0:
                    # Some messages are high priority, others are critical.
                    # These must be spoken instead of anything else queued up.
                    if length == 1 or line[0] == '!':
                        speaker.stop()

                    speaker.say(line)
                else:
                    # Blank line occurs after all the initialisation spewage
                    speaker.stop()

                if retcode is not None:
                    if retcode != 0:
                        stderr = proc.stderr.read().decode('ascii')
                        if len(stderr) > 0:
                            raise EngineWrapperError(stderr)
                        else:
                            raise EngineWrapperError()
                    break
        except:  # noqa E722
            self._on_error(*sys.exc_info())
Пример #8
0
	def __init__(self, parent):
		screen_width, screen_height = wx.GetDisplaySize()

		wx.Dialog.__init__(
			self, parent, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
			size=(screen_width * 0.5, screen_height * 0.7),
			title='Key bindings')
		sizer = wx.BoxSizer(wx.VERTICAL)

		browser = wx.html2.WebView.New(self)
		display = format_bindings_as_html()
		browser.SetPage(display, "")
		sizer.Add(browser, 1, wx.EXPAND, 10)

		close = wx.Button(self, -1, 'Close')
		close.Bind(wx.EVT_BUTTON, lambda event: self.Destroy())
		add_widget(sizer, close)

		self.SetSizer(sizer)

		doset_only(windows=lambda: windows_accessibility_fix(browser))
Пример #9
0
def gui_main(game_controller, args):
    import wx

    from launcherlib.ui.launcher import LauncherWindow
    from launcherlib.ui.helpers import Warn, gui_error_hook

    app = wx.App()
    sys.excepthook = gui_error_hook
    game_controller.set_error_handler(gui_error_hook)

    try:
        LauncherWindow(None, "AudioQuake & LDL Launcher",
                       game_controller).Show()
        app.MainLoop()
    except OSError:
        doset_only(mac=lambda: Warn(None, (
            'The code behind AudioQuake, Level Description Language and '
            "supporting tools is not signed, so it can't be verified by "
            'Apple.\n\n'
            'If you still want to run them, move this application somewhere '
            'else on your computer and re-open it.\n\n'
            "If you've already done that, you may need to grant permission "
            'for the application to access certain folders, in System '
            'Preferences > Security & Privacy > Privacy tab.')))
Пример #10
0
def _play_core(action):
	doset_only(windows=cli_first_time_windows_check)
	cli_acknowledged_warnings_check()
	result = action()
	print('Result of launching game:', result)
Пример #11
0
def _play_core(action):
    doset_only(windows=cli_first_time_windows_check)
    result = action()
    print('Result of launching game:', result)
Пример #12
0
        )
        sys.exit(42)


def _play_core(action):
    doset_only(windows=cli_first_time_windows_check)
    result = action()
    print('Result of launching game:', result)


if __name__ == '__main__':
    sys.excepthook = text_error_hook
    game_controller = GameController()
    game_controller.set_error_handler(text_error_hook)
    config.init(dirs.config)
    doset_only(windows=windows_chdir)

    parser = argparse.ArgumentParser(
        description='AudioQuake & Level Description Language Launcher',
        epilog='There is a separate LDL command-line tool in the AGRIP repo.')
    subparsers = parser.add_subparsers(
        title='actions',
        description='issue "{action} -h/--help" for more help on each one',
        help='By default the Launcher will start in GUI mode')

    map_cmd = subparsers.add_parser(
        'map', help='Boot into a particular map (via Quake or Open Quartz)')
    map_cmd.add_argument('name', help="The map's name without trailing '.bsp'")
    map_cmd.set_defaults(func=play_map)

    ls_mods_cmd = subparsers.add_parser('list-mods',
Пример #13
0
def start_server_windows(parent):
	doset_only(windows=lambda: first_time_windows_firewall_info(parent))
	if registered_check():
		run_win_console([dirs.engines / 'zqds.exe', '-basedir', dirs.data])
Пример #14
0
    def __init__(self, parent, game_controller):
        wx.Panel.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)

        resolution_strings = get_resolution_strings(RESOLUTIONS)

        # Settings

        add_opener_buttons(
            self, sizer, {
                'Edit autoexec.cfg (with default editor)':
                dirs.data / 'id1' / 'autoexec.cfg',
                'Edit config.cfg (with default editor)':
                dirs.data / 'id1' / 'config.cfg'
            })

        # Install registered data

        add_widget(sizer, wx.StaticLine(self, -1))
        reg_data_button = wx.Button(self, -1, 'Install registered Quake data')
        reg_data_button.Bind(wx.EVT_BUTTON, self.install_data_handler)
        add_widget(sizer, reg_data_button)

        # Video mode settings

        add_widget(sizer, wx.StaticLine(self, -1))

        box = platform_appropriate_grouping(self, 'Video mode')

        res_label = wx.StaticText(self, label='Resolution:')
        res_pick = wx.Choice(self, -1, choices=resolution_strings)

        try:
            index = int(config.resolution())
        except:  # noqa 722
            index = DEFAULT_RESOLUTION_INDEX
        res_pick.SetSelection(index)

        res_pick.Bind(wx.EVT_CHOICE,
                      lambda event: config.resolution(event.GetSelection()))

        add_widget(box, associate_controls(res_label, res_pick))

        doset_only(windows=lambda: add_widget(
            box,
            wx.StaticText(self, -1,
                          "Modes may be cropped when Windows' UI is scaled.")))

        def mode_test(event):
            doset_only(
                windows=lambda: first_time_windows_firewall_info(parent))
            if not game_flickering_check(parent):
                return
            game_controller.launch_tutorial()

        quick_test = wx.Button(self, -1, 'Try it out: Play tutorial')
        quick_test.Bind(wx.EVT_BUTTON, mode_test)
        add_widget(box, quick_test)

        def reset_to_defaults(event):
            res_pick.SetSelection(DEFAULT_RESOLUTION_INDEX)
            choice_event = wx.CommandEvent(wx.wxEVT_CHOICE)
            choice_event.SetInt(DEFAULT_RESOLUTION_INDEX)
            wx.PostEvent(res_pick, choice_event)
            res_pick.Enable()

        reset = wx.Button(self, -1, 'Reset video mode to default')
        reset.Bind(wx.EVT_BUTTON, reset_to_defaults)
        add_widget(box, reset)

        add_widget(sizer, box)

        # Wiring

        sizer.SetSizeHints(self)
        self.SetSizer(sizer)
Пример #15
0
			'The code behind AudioQuake, Level Description Language and '
			"supporting tools is not signed, so it can't be verified by "
			'Apple.\n\n'

			'If you still want to run them, move this application somewhere '
			'else on your computer, then move it back here and re-open it.\n\n'

			"If you've already done that, you may need to grant permission "
			'for the application to access certain folders, in System '
			'Preferences > Security & Privacy > Privacy tab.'))
		sys.exit(0)


if __name__ == '__main__':
	if hasattr(sys, '_MEIPASS'):
		doset_only(mac=macos_gatekeeper_warning)

	sys.excepthook = text_error_hook
	game_controller = GameController()
	game_controller.set_error_handler(text_error_hook)
	_dob_validated = config.init(dirs.config)
	doset_only(windows=windows_chdir)

	parser = argparse.ArgumentParser(
		description='AudioQuake & Level Description Language Launcher',
		epilog='There is a separate LDL command-line tool in the AGRIP repo.')
	subparsers = parser.add_subparsers(
		title='actions',
		description='issue "{action} -h/--help" for more help on each one',
		help='By default the Launcher will start in GUI mode')
Пример #16
0
    def __init__(self, parent, game_controller):
        wx.Panel.__init__(self, parent)
        sizer = wx.BoxSizer(wx.VERTICAL)

        # Settings

        add_opener_buttons(
            self, sizer, {
                'Edit autoexec.cfg (with default editor)':
                dirs.data / 'id1' / 'autoexec.cfg',
                'Edit config.cfg (with default editor)':
                dirs.data / 'id1' / 'config.cfg'
            })

        # Install registered data

        add_widget(sizer, wx.StaticLine(self, -1))
        reg_data_button = wx.Button(self, -1, 'Install registered Quake data')
        reg_data_button.Bind(wx.EVT_BUTTON, self.install_data_handler)
        add_widget(sizer, reg_data_button)

        # Video mode settings

        add_widget(sizer, wx.StaticLine(self, -1))
        add_widget(
            sizer,
            wx.StaticText(self,
                          -1,
                          'Video mode settings',
                          style=wx.ALIGN_CENTRE_HORIZONTAL))

        fullscreen = wx.CheckBox(self, -1,
                                 'Run full-screen (instead of windowed)')

        fullscreen.SetValue(config.fullscreen())
        fullscreen.Bind(wx.EVT_CHECKBOX,
                        lambda event: config.fullscreen(event.IsChecked()))
        add_widget(sizer, fullscreen)

        resolution_hbox = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, label='Resolution: ')

        pick_res = wx.Choice(self, -1, choices=RESOLUTIONS)

        index, _ = resolution_index_from_config()
        if index >= 0:
            pick_res.SetSelection(index)
        else:
            pick_res.Disable()

        pick_res.Bind(
            wx.EVT_CHOICE,
            lambda event: config.resolution(RESOLUTIONS[event.GetSelection()]))

        add_widget(resolution_hbox, label, border=False)
        add_widget(resolution_hbox, pick_res, border=False, expand=True)
        add_widget(sizer, resolution_hbox)

        doset_only(windows=lambda: add_widget(
            sizer,
            wx.StaticText(self, -1,
                          "Some modes may not be available full-screen.")))
        doset_only(windows=lambda: add_widget(
            sizer,
            wx.StaticText(self, -1,
                          "Modes may be cropped when Windows' UI is scaled.")))

        quick_test = wx.Button(self, -1, 'Try it out: Play tutorial')
        quick_test.Bind(wx.EVT_BUTTON,
                        lambda event: game_controller.launch_tutorial())
        add_widget(sizer, quick_test)

        def reset_to_defaults(event):
            fullscreen.SetValue(False)
            wx.PostEvent(fullscreen, wx.CommandEvent(wx.wxEVT_CHECKBOX))
            pick_res.SetSelection(DEFAULT_RESOLUTION_INDEX)
            choice_event = wx.CommandEvent(wx.wxEVT_CHOICE)
            choice_event.SetInt(DEFAULT_RESOLUTION_INDEX)
            wx.PostEvent(pick_res, choice_event)
            pick_res.Enable()

        reset = wx.Button(self, -1, 'Reset video mode to defaults')
        reset.Bind(wx.EVT_BUTTON, reset_to_defaults)
        add_widget(sizer, reset)

        # Wiring

        sizer.SetSizeHints(self)
        self.SetSizer(sizer)
Пример #17
0
 def mode_test(event):
     doset_only(
         windows=lambda: first_time_windows_firewall_info(parent))
     if not game_flickering_check(parent):
         return
     game_controller.launch_tutorial()