Skip to content

Commit

Permalink
Get the text entry for the folder working
Browse files Browse the repository at this point in the history
  • Loading branch information
teleportingtortoise committed Jun 6, 2022
1 parent 41360b6 commit 075819d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 30 deletions.
5 changes: 3 additions & 2 deletions gui/preferenceswindow.glade
Original file line number Diff line number Diff line change
Expand Up @@ -779,12 +779,13 @@ This is MyPaint's old behaviour, and can be used as a stopgap for non-sRGB worki
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkEntry" id="scrap_directory_entry">
<object class="GtkEntry" id="scrap_folder_entry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-markup" translatable="yes">Accepts &lt;i&gt;directives&lt;/i&gt; from Python's &lt;i&gt;time.strftime&lt;/i&gt;.</property>
<property name="hexpand">True</property>
<property name="invisible-char">•</property>
<signal name="changed" handler="scrap_folder_entry_changed_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -793,7 +794,7 @@ This is MyPaint's old behaviour, and can be used as a stopgap for non-sRGB worki
</packing>
</child>
<child>
<object class="GtkButton" id="scrap_directory_button">
<object class="GtkButton" id="scrap_folder_button">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
Expand Down
25 changes: 0 additions & 25 deletions gui/preferenceswindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,31 +295,6 @@ def pressure_curve_changed_cb(self, widget):
self.app.preferences['input.global_pressure_mapping'] = points
self.app.apply_settings()

def scrap_folder_button_pressed_cb(self, widget):
dialog = Gtk.FileChooserDialog(
title="Choose a folder...",
transient_for=self.app.drawWindow,
action=Gtk.FileChooserAction.SELECT_FOLDER,
)
dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
dialog.add_button(Gtk.STOCK_OPEN, Gtk.ResponseType.OK)
response = dialog.run()
# for formating the output nicely when in a home folder
if sys.platform == 'win32':
ud_docs = lib.glib.get_user_special_dir(
GLib.UserDirectory.DIRECTORY_DOCUMENTS,
)
folderprefix = ud_docs
else:
folderprefix = u'~/'
if response == Gtk.ResponseType.OK:
folder = dialog.get_filename()
folder = folder.replace(
os.path.expanduser('~') + os.sep, folderprefix)
self.app.preferences['saving.scrap_folder'] = folder
self.app.apply_settings()
dialog.destroy()

def scrap_folder_entry_changed_cb(self, widget):
scrap_folder = widget.get_text()
if isinstance(scrap_folder, bytes):
Expand Down
5 changes: 2 additions & 3 deletions gui/userconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ def default_configuration():
ud_docs = lib.glib.get_user_special_dir(
GLib.UserDirectory.DIRECTORY_DOCUMENTS,
)
scrapfldr = os.path.join(ud_docs, u'MyPaint')
scrapfldr = os.path.join(ud_docs, u'MyPaint', u'scrap')
else:
scrapfldr = u'~/MyPaint'
scrapfldr = u'~/MyPaint/'
default_config = {
'saving.scrap_folder': scrapfldr,
'saving.scrap_prefix': 'scrap',
'saving.scrap_prefix_timestamp': False,
'input.device_mode': 'screen',
'input.global_pressure_mapping': [(0.0, 1.0), (1.0, 0.0)],
'input.use_barrel_rotation': True,
Expand Down

0 comments on commit 075819d

Please sign in to comment.