fix grace export bugs; closes #155

This commit is contained in:
Dominik Demuth 2023-11-23 19:43:50 +01:00
parent 412708cecd
commit e063abc712
3 changed files with 30 additions and 14 deletions

View File

@ -690,6 +690,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
'plots': (self.real_button.isChecked(), self.imag_button.isChecked(), self.error_button.isChecked()), 'plots': (self.real_button.isChecked(), self.imag_button.isChecked(), self.error_button.isChecked()),
'children': self.sets, 'children': self.sets,
'active': self._active, 'active': self._active,
'invert': (self.plotItem.vb.state['xInverted'], self.plotItem.vb.state['yInverted']),
} }
in_legend = [] in_legend = []

View File

@ -28,14 +28,19 @@ class GraceExporter:
new_g.set_log(x=self.__opts['log'][0], y=self.__opts['log'][1]) new_g.set_log(x=self.__opts['log'][0], y=self.__opts['log'][1])
new_g.set_onoff('legend', self.__opts['legend']) new_g.set_onoff('legend', self.__opts['legend'])
new_g.set_property(**{'title': f'"{convert(self.__opts["labels"][2], old="html", new="agr")}"', new_g.set_property(**{
'title': f'"{convert(self.__opts["labels"][2], old="html", new="agr")}"',
'legend loctype': 'view', 'legend loctype': 'view',
'legend': ', '.join(str(i) for i in new_g.world_to_view(self.__opts['legend_pos']))}) 'legend': ', '.join(str(i) for i in new_g.world_to_view(self.__opts['legend_pos']))
})
for i, ax in enumerate('xy'): for i, ax in enumerate('xy'):
new_g.set_axis_property(ax, **{'label': f'"{convert(self.__opts["labels"][i], old="html", new="agr")}"', new_g.set_axis_property(ax, **{
'label': f'"{convert(self.__opts["labels"][i], old="html", new="agr")}"',
'tick major': self.__opts['ticks'][i][0], 'tick major': self.__opts['ticks'][i][0],
'tick minor ticks': self.__opts['ticks'][i][1],}) 'tick minor ticks': self.__opts['ticks'][i][1],
'invert': 'on' if self.__opts['invert'][i] else 'off',
})
new_g.set_axis_onoff(ax, 'tick major grid', self.__opts['grid']) new_g.set_axis_onoff(ax, 'tick major grid', self.__opts['grid'])
g_idx = new_g.idx g_idx = new_g.idx
else: else:
@ -59,8 +64,13 @@ class GraceExporter:
colors[c_num] = (f'color{c_num}', sc) colors[c_num] = (f'color{c_num}', sc)
new_colors.append((c_num, f'color{c_num}', sc)) new_colors.append((c_num, f'color{c_num}', sc))
new_s.set_symbol(**{'symbol': item['symbol'].value, 'size': item['symbolsize'] / 10., 'color': c_num, new_s.set_symbol(**{
'fill color': c_num, 'fill pattern': 1}) 'symbol': item['symbol'].value,
'size': item['symbolsize'] / 10.,
'color': c_num,
'fill color': c_num,
'fill pattern': 1
})
new_s.set_onoff('errorbar', self.__opts['plots'][2]) new_s.set_onoff('errorbar', self.__opts['plots'][2])
lc = item['linecolor'] lc = item['linecolor']
@ -74,12 +84,17 @@ class GraceExporter:
colors[c_num + 1] = () colors[c_num + 1] = ()
new_colors.append((c_num, f'color{c_num + 1}', sc)) new_colors.append((c_num, f'color{c_num + 1}', sc))
new_s.set_line(**{'color': c_num, 'linewidth': item['linewidth'], new_s.set_line(**{
'linestyle': item['linestyle'].to_agr()}) 'color': c_num,
'linewidth': item['linewidth'],
'linestyle': item['linestyle'].to_agr()
})
if plot_label: if plot_label:
new_s.set_property(comment=f'"{item["name"]}"', new_s.set_property(
legend=f'"{convert(item["name"], old="tex", new="agr")}"') comment=f'"{item["name"]}"',
legend=f'"{convert(item["name"], old="tex", new="agr")}"'
)
else: else:
new_s.set_property(comment=f'"{item["name"]}"') new_s.set_property(comment=f'"{item["name"]}"')

View File

@ -33,9 +33,9 @@ big_greek = [
special_chars = [ special_chars = [
r'\infty \int \sum \langle \rangle \pm \perp \para \leftarrow \rightarrow \leftrightarrow \cdot \hbar \n', r'\infty \int \sum \langle \rangle \pm \perp \para \leftarrow \rightarrow \leftrightarrow \cdot \hbar \n',
'\u221e \u222b \u2211 \u27e8 \u27e9 \u00b1 \u27c2 \u2225 \u21d0 \u21d2 \u21d4 \u00b7 \u0127 <br>', '\u221e \u222b \u2211 \u27e8 \u27e9 \u00b1 \u27c2 \u2225 \u21d0 \u21d2 \u21d4 \u00b7 \u0127 <br>',
r'\f{Symbol}¥\f{} \f{Symbol}ò\f{} \f{Symbol}å\f{} \f{Symbol}á\f{} \f{Symbol}ñ\f{} \f{Symbol}±\f{} \n' r'\f{Symbol}¥\f{} \f{Symbol}ò\f{} \f{Symbol}å\f{} \f{Symbol}á\f{} \f{Symbol}ñ\f{} \f{Symbol}±\f{} '
r'\f{Symbol}^\f{} \f{Symbol}||\f{} \f{Symbol}¬\f{} \f{Symbol}®\f{} \f{Symbol}«\f{} \f{Symbol}×\f{Symbol} ' r'\f{Symbol}^\f{} \f{Symbol}||\f{} \f{Symbol}¬\f{} \f{Symbol}®\f{} \f{Symbol}«\f{} \f{Symbol}×\f{Symbol} '
r'h\h{-0.6}\v{0.3}-\v{-0.3}\h{0.3}', r'h\h{-0.6}\v{0.3}-\v{-0.3}\h{0.3} \n',
r'infty int sum < > \+- perp para <- -> <-> \* hbar \s', r'infty int sum < > \+- perp para <- -> <-> \* hbar \s',
] ]
funcs = [ funcs = [