Skip to content

Commit

Permalink
Merge pull request #385 from hhslepicka/fix_related_windows
Browse files Browse the repository at this point in the history
FIX: Related Display button opening properly in New Window for Windows.
  • Loading branch information
mattgibbs authored Aug 15, 2018
2 parents f768987 + 2578a8e commit 4f4097d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pydm/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def new_pydm_process(self, ui_file, macros=None, command_line_args=None):
to pass in extra arguments. It is probably rare that code you
write needs to use this argument.
"""
path_and_args = shlex.split(str(ui_file))
filepath = path_and_args[0]
filepath_args = path_and_args[1:]
base_dir, fname, args = path_info(str(ui_file))
filepath = os.path.join(base_dir, fname)
filepath_args = args
pydm_display_app_path = which("pydm")

if pydm_display_app_path is None:
Expand All @@ -218,6 +218,8 @@ def new_pydm_process(self, ui_file, macros=None, command_line_args=None):
args.append(filepath)
args.extend(self.display_args)
args.extend(filepath_args)
if command_line_args is not None:
args.extend(command_line_args)
subprocess.Popen(args, shell=False)

def new_window(self, ui_file, macros=None, command_line_args=None):
Expand Down
1 change: 1 addition & 0 deletions pydm/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def new_window(self, ui_file, macros=None, command_line_args=None):
new_fname = find_display_in_path(ui_file)
if new_fname is None or new_fname == "":
raise IOError("File {} not found".format(filename))
filename = new_fname
self.new_abs_window(filename, macros, command_line_args)
except (IOError, OSError, ValueError, ImportError) as e:
error_msg = "Cannot open file: '{0}'. Reason: '{1}'.".format(filename, e)
Expand Down

0 comments on commit 4f4097d

Please sign in to comment.