Commit d4762468 authored by sumpfralle's avatar sumpfralle

added a "copy to clipboard" button to the log window


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@587 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 525b671a
......@@ -226,6 +226,8 @@ class ProjectGui:
self.log_window.connect("destroy", self.toggle_log_window, False)
self.gui.get_object("LogWindowClose").connect("clicked", self.toggle_log_window, False)
self.gui.get_object("LogWindowClear").connect("clicked", self.clear_log_window)
self.gui.get_object("LogWindowCopyToClipboard").connect("clicked",
self.copy_log_to_clipboard)
self.log_model = self.gui.get_object("LogWindowList")
# set defaults
self.model = None
......@@ -1218,6 +1220,18 @@ class ProjectGui:
# update the status bar
self.status_bar.push(0, message)
@gui_activity_guard
def copy_log_to_clipboard(self, widget=None):
content = []
def copy_row(model, path, it, content):
columns = []
for column in range(model.get_n_columns()):
columns.append(model.get_value(it, column))
content.append(" ".join(columns))
self.log_model.foreach(copy_row, content)
clipboard = gtk.Clipboard()
clipboard.set_text(os.linesep.join(content))
@gui_activity_guard
def clear_log_window(self, widget=None):
self.log_model.clear()
......
......@@ -6015,6 +6015,21 @@ Any selected group of dimensions will be scaled accordingly.</property>
<object class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="LogWindowCopyToClipboard">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Copy the content of the log to the clipboard.</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="LogWindowClear">
<property name="label">gtk-clear</property>
......@@ -6026,7 +6041,7 @@ Any selected group of dimensions will be scaled accordingly.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
......@@ -6040,7 +6055,7 @@ Any selected group of dimensions will be scaled accordingly.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
......@@ -6053,6 +6068,7 @@ Any selected group of dimensions will be scaled accordingly.</property>
</object>
</child>
<action-widgets>
<action-widget response="0">LogWindowCopyToClipboard</action-widget>
<action-widget response="0">LogWindowClear</action-widget>
<action-widget response="0">LogWindowClose</action-widget>
</action-widgets>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment