Skip to content

Commit

Permalink
Incorporate suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed Aug 12, 2022
1 parent b4ec16c commit 8c1484d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
15 changes: 1 addition & 14 deletions general/g.gui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

int main(int argc, char *argv[])
{
struct Option *type, *rc_file, *recent_files;
struct Option *type, *rc_file;
struct Flag *update_ui, *fglaunch, *nolaunch;
struct GModule *module;
const char *gui_type_env;
Expand Down Expand Up @@ -66,13 +66,6 @@ int main(int argc, char *argv[])
rc_file->label = _("Name of workspace file to load on start-up");
rc_file->description = _("This is valid only for wxGUI (wxpython)");

recent_files = G_define_option();
recent_files->key = "recent_files";
recent_files->type = TYPE_STRING;
recent_files->options = "main,pyedit";
recent_files->label = _("wxGUI component name");
recent_files->description = _("This is valid only for wxGUI (wxpython)");

fglaunch = G_define_flag();
fglaunch->key = 'f';
fglaunch->label = _("Start GUI in the foreground");
Expand Down Expand Up @@ -114,12 +107,6 @@ int main(int argc, char *argv[])
if (access(progname, F_OK) == -1)
G_fatal_error(_("Your installation doesn't include GUI, exiting."));

if (recent_files->answer) {
G_spawn_ex(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), progname,
"--recent_files", recent_files->answer, NULL);
exit(EXIT_SUCCESS);
}

if (fglaunch->answer) {
G_message(_("Launching <%s> GUI, please wait..."), type->answer);
if (rc_file->answer) {
Expand Down
22 changes: 11 additions & 11 deletions gui/wxpython/wxgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,18 @@ def process_opt(opts, args):
return parsed_args


def print_wxgui_component_recent_files(args):
def print_wxgui_component_recent_files(recent_files):
"""Print wxGUI component recent files
:param args dict: parsed command-line args
:param str recent_files: app recent files name
"""
recent_files_app_name = args.get("r")
if recent_files_app_name:
from gui_core.menu import RecentFilesConfig
from gui_core.menu import RecentFilesConfig

app = wx.App()
config = RecentFilesConfig(appName=recent_files_app_name)
for i in config.GetRecentFiles():
print(i, file=sys.stderr)
sys.exit(1)
app = wx.App()
config = RecentFilesConfig(appName=recent_files)
for i in config.GetRecentFiles():
print(i, file=sys.stderr)
sys.exit(1)


def main(argv=None):
Expand All @@ -196,7 +194,9 @@ def main(argv=None):

parsed_args = process_opt(opts, args)

print_wxgui_component_recent_files(args=parsed_args)
recent_files = parsed_args.get("r")
if recent_files:
print_wxgui_component_recent_files(recent_files)

app = GMApp(workspace=parsed_args.get("w"))

Expand Down

0 comments on commit 8c1484d

Please sign in to comment.