Skip to content

Commit eedf9d3

Browse files
committed
qtvcp -macroTab: fix saving data to specified path
4am is too early to get this all right the first time it seems
1 parent 6e5a345 commit eedf9d3

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

docs/src/gui/qtvcp-widgets.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ If the keyword is present but the entries are missing, no images will be used.
14201420

14211421
This _optional line must be the fourth_ line in the O-word file.
14221422

1423-
It is a comma separated list of keyword and data, all of wgich are optional:
1423+
It is a comma separated list of keyword and data, all of which are optional:
14241424

14251425
*`LOAD:yes`*::
14261426
Shows a load button.

lib/python/qtvcp/widgets/macro_widget.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,16 +633,15 @@ def getFileName(self):
633633
macro = self.stack.currentWidget().objectName()
634634
dirct = self[macro][2].get('PATH')
635635
defaultfilename = self[macro][2].get('DEFAULT')
636+
636637
mess = {'NAME':self.load_dialog_code,'ID':'%s__' % self.objectName(),
637638
'TITLE':'Load Macro',
638-
'FILENAME':'%s_data.txt' % str(self.stack.currentWidget().objectName()),
639639
'EXTENSIONS':'Text Files (*.txt);;ALL Files (*.*)'
640640
}
641641
if not defaultfilename is None:
642642
mess['FILENAME'] = defaultfilename
643643
else:
644-
pass
645-
#mess['FILENAME'] = '{}_data.txt'.format( str(self.stack.currentWidget().objectName()))
644+
mess['FILENAME'] = '{}_data.txt'.format( str(self.stack.currentWidget().objectName()))
646645
if not dirct is None:
647646
mess['DIRECTORY'] = dirct
648647
STATUS.emit('dialog-request', mess)
@@ -651,9 +650,20 @@ def getFileName(self):
651650
# do this so the system is consistent and things like dialog
652651
# placement are done.
653652
def getSaveFileName(self):
653+
macro = self.stack.currentWidget().objectName()
654+
dirct = self[macro][2].get('PATH')
655+
defaultfilename = self[macro][2].get('DEFAULT')
656+
654657
mess = {'NAME':self.save_dialog_code,'ID':'%s__' % self.objectName(),
655-
'TITLE':'Save Macro', 'FILENAME':'%s_data.txt' % str(self.stack.currentWidget().objectName()),
656-
'EXTENSIONS':'Text Files (*.txt);;ALL Files (*.*)'}
658+
'TITLE':'Save Macro',
659+
'EXTENSIONS':'Text Files (*.txt);;ALL Files (*.*)'
660+
}
661+
if not defaultfilename is None:
662+
mess['FILENAME'] = defaultfilename
663+
else:
664+
mess['FILENAME'] = '{}_data.txt'.format( str(self.stack.currentWidget().objectName()))
665+
if not dirct is None:
666+
mess['DIRECTORY'] = dirct
657667
STATUS.emit('dialog-request', mess)
658668

659669
# process the STATUS return message from dialogs

0 commit comments

Comments
 (0)