Skip to content

Commit

Permalink
Author editor and text sizes
Browse files Browse the repository at this point in the history
* AuthorLoops is now finally initialized on block load and not before. Options are now disabled without a CIF
* The size of the fields over the table is now set more dynamically
  • Loading branch information
dkratzert committed Mar 13, 2024
1 parent 830c109 commit 8bbc0cb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 47 deletions.
19 changes: 14 additions & 5 deletions finalcif/appwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(self, file: Optional[Path] = None):
self.properties = Properties(parent=self, settings=self.settings)
self.status_bar = StatusBar(ui=self.ui)
self.status_bar.show_message('FinalCif version {}'.format(VERSION))
self.authors = AuthorLoops(ui=self.ui, cif=self.cif, app=self)
self.authors: Union[AuthorLoops, None] = None
self.set_window_size_and_position()
self.ui.cif_main_table.installEventFilter(self)
# Sorting desynchronized header and columns:
Expand Down Expand Up @@ -159,8 +159,7 @@ def set_initial_button_states(self) -> None:
self.ui.CCDCpushButton.setDisabled(True)
self.ui.ShredCifButton.setDisabled(True)
self.ui.LoopsPushButton.setDisabled(True)
# Ok to be enabled:
# self.ui.OptionsPushButton.setDisabled(True)
self.ui.OptionsPushButton.setDisabled(True)
self.ui.AuthorEditPushButton.setDisabled(True)

def enable_buttons(self):
Expand Down Expand Up @@ -202,6 +201,7 @@ def set_font_sizes(self) -> None:
self.ui.docxTemplatesListWidget.setFont(mid_font)
self.ui.PropertiesTemplatesListWidget.setFont(mid_font)
self.ui.depositOutputTextBrowser.setFont(mid_font)
self.setTextEditSizes()

def set_window_size_and_position(self) -> None:
wsettings = self.settings.load_window_position()
Expand Down Expand Up @@ -629,6 +629,15 @@ def resizeEvent(self, a0: QtGui.QResizeEvent) -> None:
# Not necessary here, it is done in MyCifTable
# threading.Thread(target=self.ui.cif_main_table.resizeRowsToContents).start()
# QtCore.QTimer(self).singleShot(0, self.ui.cif_main_table.resizeRowsToContents)
self.setTextEditSizes()

def setTextEditSizes(self):
for ui in [self.ui.Spacegroup_top_LineEdit, self.ui.CCDCNumLineEdit, self.ui.SumFormMainLineEdit]:
ui.setFixedHeight(self.ui.appendCifPushButton.height() + 6)
ui.setFixedHeight(self.ui.appendCifPushButton.height() + 6)
ui.setFixedHeight(self.ui.appendCifPushButton.height() + 6)
vScrollBar = ui.verticalScrollBar()
vScrollBar.triggerAction(QScrollBar.SliderSingleStepAdd)

def moveEvent(self, a0: QtGui.QMoveEvent) -> None:
"""Is called when the main window moves."""
Expand Down Expand Up @@ -1130,8 +1139,8 @@ def make_report_tables(self) -> None:
ok = t.make_templated_docx_report(output_filename=str(report_filename),
picfile=picfile,
template_path=Path(self.get_checked_templates_list_text()))
#t = TemplatedReport(format=ReportFormat.HTML, options=self.options, cif=self.cif)
#t.make_templated_html_report(options=self.options, picfile=picfile)
# t = TemplatedReport(format=ReportFormat.HTML, options=self.options, cif=self.cif)
# t.make_templated_html_report(options=self.options, picfile=picfile)
if not ok:
return None
except FileNotFoundError as e:
Expand Down
6 changes: 0 additions & 6 deletions finalcif/gui/finalcif_gui_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,8 +1751,6 @@ def setupUi(self, FinalCifWindow):
self.datanameComboBox.setObjectName("datanameComboBox")
self.gridLayout_6.addWidget(self.datanameComboBox, 0, 1, 1, 1)
self.CCDCNumLineEdit = QtWidgets.QTextEdit(self.CifDataItemsFrame)
self.CCDCNumLineEdit.setMinimumSize(QtCore.QSize(0, 24))
self.CCDCNumLineEdit.setMaximumSize(QtCore.QSize(16777215, 24))
self.CCDCNumLineEdit.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.IBeamCursor))
self.CCDCNumLineEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.CCDCNumLineEdit.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
Expand All @@ -1764,8 +1762,6 @@ def setupUi(self, FinalCifWindow):
self.CCDCNumLineEdit.setObjectName("CCDCNumLineEdit")
self.gridLayout_6.addWidget(self.CCDCNumLineEdit, 0, 8, 1, 1)
self.SumFormMainLineEdit = QtWidgets.QTextEdit(self.CifDataItemsFrame)
self.SumFormMainLineEdit.setMinimumSize(QtCore.QSize(0, 24))
self.SumFormMainLineEdit.setMaximumSize(QtCore.QSize(16777215, 24))
self.SumFormMainLineEdit.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.IBeamCursor))
self.SumFormMainLineEdit.setInputMethodHints(QtCore.Qt.ImhNone)
self.SumFormMainLineEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
Expand Down Expand Up @@ -1794,8 +1790,6 @@ def setupUi(self, FinalCifWindow):
spacerItem42 = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_6.addItem(spacerItem42, 0, 6, 1, 1)
self.Spacegroup_top_LineEdit = QtWidgets.QTextEdit(self.CifDataItemsFrame)
self.Spacegroup_top_LineEdit.setMinimumSize(QtCore.QSize(0, 24))
self.Spacegroup_top_LineEdit.setMaximumSize(QtCore.QSize(16777215, 24))
self.Spacegroup_top_LineEdit.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.IBeamCursor))
self.Spacegroup_top_LineEdit.setInputMethodHints(QtCore.Qt.ImhNone)
self.Spacegroup_top_LineEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
Expand Down
36 changes: 0 additions & 36 deletions finalcif/gui/finalcif_gui_ui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -4105,18 +4105,6 @@ please add a publication author:</string>
</item>
<item row="0" column="8">
<widget class="QTextEdit" name="CCDCNumLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="cursor" stdset="0">
<cursorShape>IBeamCursor</cursorShape>
</property>
Expand Down Expand Up @@ -4145,18 +4133,6 @@ please add a publication author:</string>
</item>
<item row="0" column="11">
<widget class="QTextEdit" name="SumFormMainLineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="cursor" stdset="0">
<cursorShape>IBeamCursor</cursorShape>
</property>
Expand Down Expand Up @@ -4248,18 +4224,6 @@ please add a publication author:</string>
</item>
<item row="0" column="5">
<widget class="QTextEdit" name="Spacegroup_top_LineEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>24</height>
</size>
</property>
<property name="cursor" stdset="0">
<cursorShape>IBeamCursor</cursorShape>
</property>
Expand Down

0 comments on commit 8bbc0cb

Please sign in to comment.