diff options
author | Sebastian Koslowski <sebastian.koslowski@gmail.com> | 2017-10-26 20:41:08 +0200 |
---|---|---|
committer | Sebastian Koslowski <sebastian.koslowski@gmail.com> | 2017-10-26 21:21:54 +0200 |
commit | 865e2586b4f34fce101d8aa4a240431273009b8c (patch) | |
tree | d4539ae70e5b004623621ecd00d0175bc1b11378 /grc | |
parent | 5ba75e6cbf432a39e94efb9ec915259e1424c3e4 (diff) | |
parent | f91ed4fe77135ae23ab97566ac782c722439606b (diff) |
Merge branch 'merges/next' into merges/python3
Diffstat (limited to 'grc')
-rw-r--r-- | grc/blocks/virtual_sink.block.yml | 13 | ||||
-rw-r--r-- | grc/blocks/virtual_source.block.yml | 13 | ||||
-rw-r--r-- | grc/gui/Application.py | 2 | ||||
-rw-r--r-- | grc/gui/ParamWidgets.py | 31 | ||||
-rw-r--r-- | grc/gui/PropsDialog.py | 7 | ||||
-rw-r--r-- | grc/gui/canvas/flowgraph.py | 4 |
6 files changed, 26 insertions, 44 deletions
diff --git a/grc/blocks/virtual_sink.block.yml b/grc/blocks/virtual_sink.block.yml deleted file mode 100644 index 4a2fd0108e..0000000000 --- a/grc/blocks/virtual_sink.block.yml +++ /dev/null @@ -1,13 +0,0 @@ -id: virtual_sink -label: Virtual Sink - -parameters: -- id: stream_id - label: Stream ID - dtype: stream_id - -inputs: -- domain: stream - dtype: '' - -file_format: 1 diff --git a/grc/blocks/virtual_source.block.yml b/grc/blocks/virtual_source.block.yml deleted file mode 100644 index cec987702a..0000000000 --- a/grc/blocks/virtual_source.block.yml +++ /dev/null @@ -1,13 +0,0 @@ -id: virtual_source -label: Virtual Source - -parameters: -- id: stream_id - label: Stream ID - dtype: stream_id - -outputs: -- domain: stream - dtype: '' - -file_format: 1 diff --git a/grc/gui/Application.py b/grc/gui/Application.py index ea7ad5cd80..70cf9b78b2 100644 --- a/grc/gui/Application.py +++ b/grc/gui/Application.py @@ -663,7 +663,7 @@ class Application(Gtk.Application): flow_graph_update(new_flow_graph) page.saved = False elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE: - file_path, background_transparent = FileDialogs.SaveScreenShot(main, page.file_path).run() + file_path, background_transparent = SaveScreenShotDialog(main, page.get_file_path()).run() if file_path is not None: try: Utils.make_screenshot(flow_graph, file_path, background_transparent) diff --git a/grc/gui/ParamWidgets.py b/grc/gui/ParamWidgets.py index 18d1da736b..747c3ffec5 100644 --- a/grc/gui/ParamWidgets.py +++ b/grc/gui/ParamWidgets.py @@ -57,12 +57,13 @@ class InputParam(Gtk.HBox): """The base class for an input parameter inside the input parameters dialog.""" expand = False - def __init__(self, param, changed_callback=None, editing_callback=None): + def __init__(self, param, changed_callback=None, editing_callback=None, transient_for=None): Gtk.HBox.__init__(self) self.param = param self._changed_callback = changed_callback self._editing_callback = editing_callback + self._transient_for = transient_for self.label = Gtk.Label() self.label.set_size_request(Utils.scale_scalar(150), -1) @@ -199,7 +200,7 @@ class PythonEditorParam(InputParam): self.pack_start(button, True, True, True) def open_editor(self, widget=None): - self.param.parent_flowgraph.install_external_editor(self.param) + self.param.parent_flowgraph.install_external_editor(self.param, parent=self._transient_for) def get_text(self): pass # we never update the value from here @@ -289,7 +290,7 @@ class FileParam(EntryParam): If the button was clicked, open a file dialog in open/save format. Replace the text in the entry with the new filename from the file dialog. """ - #get the paths + # get the paths file_path = self.param.is_valid() and self.param.get_evaluated() or '' (dirname, basename) = os.path.isfile(file_path) and os.path.split(file_path) or (file_path, '') # check for qss theme default directory @@ -301,22 +302,28 @@ class FileParam(EntryParam): if not os.path.exists(dirname): dirname = os.getcwd() # fix bad paths - #build the dialog + # build the dialog if self.param.dtype == 'file_open': - file_dialog = Gtk.FileChooserDialog('Open a Data File...', None, - Gtk.FileChooserAction.OPEN, ('gtk-cancel',Gtk.ResponseType.CANCEL,'gtk-open',Gtk.ResponseType.OK)) + file_dialog = Gtk.FileChooserDialog( + 'Open a Data File...', None, Gtk.FileChooserAction.OPEN, + ('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open', Gtk.ResponseType.OK), + transient_for=self._transient_for, + ) elif self.param.dtype == 'file_save': - file_dialog = Gtk.FileChooserDialog('Save a Data File...', None, - Gtk.FileChooserAction.SAVE, ('gtk-cancel',Gtk.ResponseType.CANCEL, 'gtk-save',Gtk.ResponseType.OK)) + file_dialog = Gtk.FileChooserDialog( + 'Save a Data File...', None, Gtk.FileChooserAction.SAVE, + ('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-save', Gtk.ResponseType.OK), + transient_for=self._transient_for, + ) file_dialog.set_do_overwrite_confirmation(True) - file_dialog.set_current_name(basename) #show the current filename + file_dialog.set_current_name(basename) # show the current filename else: raise ValueError("Can't open file chooser dialog for type " + repr(self.param.dtype)) - file_dialog.set_current_folder(dirname) #current directory + file_dialog.set_current_folder(dirname) # current directory file_dialog.set_select_multiple(False) file_dialog.set_local_only(True) - if Gtk.ResponseType.OK == file_dialog.run(): #run the dialog - file_path = file_dialog.get_filename() #get the file path + if Gtk.ResponseType.OK == file_dialog.run(): # run the dialog + file_path = file_dialog.get_filename() # get the file path self._input.set_text(file_path) self._editing_callback() self._apply_change() diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py index 9ce9bf2701..ac4506a3d8 100644 --- a/grc/gui/PropsDialog.py +++ b/grc/gui/PropsDialog.py @@ -185,12 +185,13 @@ class PropsDialog(Gtk.Dialog): continue box_all_valid = box_all_valid and param.is_valid() - input_widget = param.get_input(self._handle_changed, self._activate_apply) + input_widget = param.get_input(self._handle_changed, self._activate_apply, + transient_for=self.get_transient_for()) input_widget.show_all() vbox.pack_start(input_widget, input_widget.expand, True, 1) - label.set_markup('<span foreground="{color}">{name}</span>'.format( - color='black' if box_all_valid else 'red', name=Utils.encode(category) + label.set_markup('<span {color}>{name}</span>'.format( + color='foreground="red"' if not box_all_valid else '', name=Utils.encode(category) )) vbox.show() # show params box with new params diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py index 394b12cfba..af97ed3325 100644 --- a/grc/gui/canvas/flowgraph.py +++ b/grc/gui/canvas/flowgraph.py @@ -88,7 +88,7 @@ class FlowGraph(CoreFlowgraph, Drawable): break return block_id - def install_external_editor(self, param): + def install_external_editor(self, param, parent=None): target = (param.parent_block.name, param.key) if target in self._external_updaters: @@ -96,7 +96,7 @@ class FlowGraph(CoreFlowgraph, Drawable): else: config = self.parent_platform.config editor = (find_executable(config.editor) or - Dialogs.choose_editor(None, config)) # todo: pass in parent + Dialogs.choose_editor(parent, config)) # todo: pass in parent if not editor: return updater = functools.partial( |