Skip to content

Commit

Permalink
Improved layout and changelog, thumbails tbf
Browse files Browse the repository at this point in the history
  • Loading branch information
Ermanno Lo Cascio committed Dec 9, 2024
1 parent bed8062 commit d118f7b
Show file tree
Hide file tree
Showing 10 changed files with 311 additions and 60 deletions.
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)

## [Unreleased]

### Added
### Added

new item added 123

### Changed

### Deprecated

### Removed

Expand Down Expand Up @@ -802,5 +802,3 @@ Many parts of the Spine data structure have been redesigned.

## [0.1] - 2018-08-20

### Added
- Basic functionality
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 42 additions & 8 deletions spinetoolbox/changelog_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,55 @@
import os
import difflib
from .config import CHANGELOG_PATH
import re


'''
def save_changelog_to_settings(settings):
if os.path.isfile(CHANGELOG_PATH):
with open(CHANGELOG_PATH, "r") as fp:
cl = fp.readlines()
settings.setValue("changeLog", cl)
'''

def get_changelog_diff(settings):

def pick_latest_release(settings):
if os.path.isfile(CHANGELOG_PATH):
with open(CHANGELOG_PATH, "r") as fp:
current_changelog = fp.readlines()
old_changelog = settings.value("changelog", None)
if not old_changelog:
return None
diff = [li for li in difflib.ndiff(old_changelog, current_changelog) if li[0] != ' ']
return diff
return None
current_changelog = fp.read()

# Use regex to find all headers (e.g., ## [Version])
headers = re.findall(r'^## \[.*?\]', current_changelog, re.MULTILINE)

if headers:
# Assume the first header is the latest release (e.g., Unreleased or latest version)
latest_release_header = headers[0]

# Find the position of the latest release
latest_release_start = current_changelog.find(latest_release_header)
next_header_start = None

# Find the next header to delimit the section
for header in headers[1:]:
pos = current_changelog.find(header, latest_release_start + len(latest_release_header))
if pos != -1:
next_header_start = pos
break

# Extract the content of the latest release section
if next_header_start:
latest_release_content = current_changelog[latest_release_start:next_header_start].strip()
else:
# No further header; take till the end of the file
latest_release_content = current_changelog[latest_release_start:].strip()

Check warning on line 45 in spinetoolbox/changelog_diff.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/changelog_diff.py#L45

Added line #L45 was not covered by tests

# Split the content into lines for further processing
diff = [line.strip() for line in latest_release_content.splitlines() if line.strip()]

return diff
else:
print("No headers found in the changelog.")
return []

Check warning on line 53 in spinetoolbox/changelog_diff.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/changelog_diff.py#L52-L53

Added lines #L52 - L53 were not covered by tests
else:
print(f"Changelog not found at {CHANGELOG_PATH}")
return []

Check warning on line 56 in spinetoolbox/changelog_diff.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/changelog_diff.py#L55-L56

Added lines #L55 - L56 were not covered by tests
90 changes: 66 additions & 24 deletions spinetoolbox/ui/startup_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
################################################################################
## Form generated from reading UI file 'startup_box.ui'
##
## Created by: Qt User Interface Compiler version 6.5.2
## Created by: Qt User Interface Compiler version 6.7.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
Expand All @@ -41,10 +41,27 @@ def setupUi(self, Form):
self.groupBox_6.setMinimumSize(QSize(0, 16))
self.listWidget_2 = QListWidget(self.groupBox_6)
self.listWidget_2.setObjectName(u"listWidget_2")
self.listWidget_2.setGeometry(QRect(10, 40, 171, 561))
self.listWidget_2.setGeometry(QRect(10, 60, 171, 541))
self.listWidget_2.setStyleSheet(u"background-color: rgb(240, 240, 240);\n"
"border-color: rgb(240, 240, 240);")
self.listWidget_2.setProperty("showDropIndicator", True)
self.listWidget_2.setProperty(u"showDropIndicator", True)
self.listWidget_2.setProperty(u"isWrapping", False)
self.listWidget_2.setWordWrap(True)
self.label_17 = QLabel(self.groupBox_6)
self.label_17.setObjectName(u"label_17")
self.label_17.setGeometry(QRect(10, 20, 171, 31))
font = QFont()
font.setFamilies([u"Courier"])
font.setPointSize(11)
font.setBold(False)
font.setItalic(True)
self.label_17.setFont(font)
self.label_17.setAutoFillBackground(False)
self.label_17.setStyleSheet(u"")
self.label_17.setFrameShape(QFrame.Shape.StyledPanel)
self.label_17.setFrameShadow(QFrame.Shadow.Raised)
self.label_17.setLineWidth(1)
self.label_17.setScaledContents(False)
self.groupBox_7 = QGroupBox(Form)
self.groupBox_7.setObjectName(u"groupBox_7")
self.groupBox_7.setGeometry(QRect(50, 40, 151, 611))
Expand Down Expand Up @@ -73,27 +90,27 @@ def setupUi(self, Form):
self.scrollArea_2.setObjectName(u"scrollArea_2")
self.scrollArea_2.setGeometry(QRect(10, 10, 661, 561))
self.scrollArea_2.setStyleSheet(u"")
self.scrollArea_2.setFrameShape(QFrame.NoFrame)
self.scrollArea_2.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollArea_2.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollArea_2.setFrameShape(QFrame.Shape.NoFrame)
self.scrollArea_2.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea_2.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea_2.setWidgetResizable(False)
self.scrollAreaWidgetContents_3 = QWidget()
self.scrollAreaWidgetContents_3.setObjectName(u"scrollAreaWidgetContents_3")
self.scrollAreaWidgetContents_3.setGeometry(QRect(0, 0, 668, 642))
self.label_3 = QLabel(self.scrollAreaWidgetContents_3)
self.label_3.setObjectName(u"label_3")
self.label_3.setGeometry(QRect(10, 10, 670, 21))
font = QFont()
font.setPointSize(12)
font.setBold(True)
font.setUnderline(False)
self.label_3.setFont(font)
self.label_3.setLayoutDirection(Qt.LeftToRight)
font1 = QFont()
font1.setPointSize(12)
font1.setBold(True)
font1.setUnderline(False)
self.label_3.setFont(font1)
self.label_3.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.label_14 = QLabel(self.scrollAreaWidgetContents_3)
self.label_14.setObjectName(u"label_14")
self.label_14.setGeometry(QRect(10, 430, 670, 21))
self.label_14.setFont(font)
self.label_14.setLayoutDirection(Qt.LeftToRight)
self.label_14.setFont(font1)
self.label_14.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.groupBox_4 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_4.setObjectName(u"groupBox_4")
self.groupBox_4.setGeometry(QRect(10, 50, 631, 101))
Expand All @@ -104,6 +121,11 @@ def setupUi(self, Form):
self.pushButton = QPushButton(self.groupBox_4)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setGeometry(QRect(510, 46, 101, 20))
self.label_10 = QLabel(self.groupBox_4)
self.label_10.setObjectName(u"label_10")
self.label_10.setGeometry(QRect(20, 30, 60, 51))
self.label_10.setPixmap(QPixmap(u"../../docs/source/img/tutorials_images/say_hello_thumbnail.png"))
self.label_10.setScaledContents(True)
self.groupBox_10 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_10.setObjectName(u"groupBox_10")
self.groupBox_10.setGeometry(QRect(10, 170, 631, 111))
Expand All @@ -114,6 +136,11 @@ def setupUi(self, Form):
self.pushButton_2 = QPushButton(self.groupBox_10)
self.pushButton_2.setObjectName(u"pushButton_2")
self.pushButton_2.setGeometry(QRect(510, 52, 101, 21))
self.label_11 = QLabel(self.groupBox_10)
self.label_11.setObjectName(u"label_11")
self.label_11.setGeometry(QRect(20, 30, 60, 51))
self.label_11.setPixmap(QPixmap(u"../../docs/source/img/tutorials_images/data_structure_thumbnail.png"))
self.label_11.setScaledContents(True)
self.groupBox_11 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_11.setObjectName(u"groupBox_11")
self.groupBox_11.setGeometry(QRect(10, 300, 631, 101))
Expand All @@ -124,6 +151,11 @@ def setupUi(self, Form):
self.pushButton_4 = QPushButton(self.groupBox_11)
self.pushButton_4.setObjectName(u"pushButton_4")
self.pushButton_4.setGeometry(QRect(510, 48, 101, 21))
self.label_15 = QLabel(self.groupBox_11)
self.label_15.setObjectName(u"label_15")
self.label_15.setGeometry(QRect(20, 30, 60, 51))
self.label_15.setPixmap(QPixmap(u"../../docs/source/img/tutorials_images/workflow_thumbnail.png"))
self.label_15.setScaledContents(True)
self.groupBox_13 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_13.setObjectName(u"groupBox_13")
self.groupBox_13.setGeometry(QRect(10, 460, 631, 101))
Expand All @@ -134,6 +166,11 @@ def setupUi(self, Form):
self.pushButton_5 = QPushButton(self.groupBox_13)
self.pushButton_5.setObjectName(u"pushButton_5")
self.pushButton_5.setGeometry(QRect(510, 40, 101, 21))
self.label_16 = QLabel(self.groupBox_13)
self.label_16.setObjectName(u"label_16")
self.label_16.setGeometry(QRect(20, 30, 60, 51))
self.label_16.setPixmap(QPixmap(u"../../docs/source/img/tutorials_images/advanced_material_thumbmail.png"))
self.label_16.setScaledContents(True)
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_3)
self.tabWidget.addTab(self.tab_2, "")
self.tab = QWidget()
Expand All @@ -143,30 +180,30 @@ def setupUi(self, Form):
self.scrollArea = QScrollArea(self.tab)
self.scrollArea.setObjectName(u"scrollArea")
self.scrollArea.setEnabled(True)
self.scrollArea.setFrameShape(QFrame.NoFrame)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scrollArea.setFrameShape(QFrame.Shape.NoFrame)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
self.scrollArea.setWidgetResizable(False)
self.scrollAreaWidgetContents_2 = QWidget()
self.scrollAreaWidgetContents_2.setObjectName(u"scrollAreaWidgetContents_2")
self.scrollAreaWidgetContents_2.setGeometry(QRect(0, 0, 668, 642))
self.label = QLabel(self.scrollAreaWidgetContents_2)
self.label.setObjectName(u"label")
self.label.setGeometry(QRect(10, 10, 670, 21))
self.label.setFont(font)
self.label.setLayoutDirection(Qt.LeftToRight)
self.label.setFont(font1)
self.label.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.label_13 = QLabel(self.scrollAreaWidgetContents_2)
self.label_13.setObjectName(u"label_13")
self.label_13.setGeometry(QRect(10, 280, 621, 21))
self.label_13.setFont(font)
self.label_13.setLayoutDirection(Qt.LeftToRight)
self.label_13.setFont(font1)
self.label_13.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.groupBox_8 = QGroupBox(self.scrollAreaWidgetContents_2)
self.groupBox_8.setObjectName(u"groupBox_8")
self.groupBox_8.setGeometry(QRect(10, 120, 631, 131))
self.label_5 = QLabel(self.groupBox_8)
self.label_5.setObjectName(u"label_5")
self.label_5.setGeometry(QRect(90, 20, 351, 71))
self.label_5.setTextFormat(Qt.PlainText)
self.label_5.setTextFormat(Qt.TextFormat.PlainText)
self.label_5.setScaledContents(False)
self.label_5.setWordWrap(True)
self.pushButton_3 = QPushButton(self.groupBox_8)
Expand All @@ -181,14 +218,14 @@ def setupUi(self, Form):
self.label_12 = QLabel(self.groupBox_3)
self.label_12.setObjectName(u"label_12")
self.label_12.setGeometry(QRect(70, 20, 371, 91))
self.label_12.setTextFormat(Qt.PlainText)
self.label_12.setTextFormat(Qt.TextFormat.PlainText)
self.label_12.setScaledContents(False)
self.label_12.setWordWrap(True)
self.label_4 = QLabel(self.scrollAreaWidgetContents_2)
self.label_4.setObjectName(u"label_4")
self.label_4.setGeometry(QRect(20, 50, 531, 31))
self.label_4.setAutoFillBackground(False)
self.label_4.setTextFormat(Qt.RichText)
self.label_4.setTextFormat(Qt.TextFormat.RichText)
self.scrollArea.setWidget(self.scrollAreaWidgetContents_2)

self.verticalLayout_3.addWidget(self.scrollArea)
Expand All @@ -206,6 +243,7 @@ def setupUi(self, Form):
def retranslateUi(self, Form):
Form.setWindowTitle(QCoreApplication.translate("Form", u"Form", None))
self.groupBox_6.setTitle(QCoreApplication.translate("Form", u"Software Info", None))
self.label_17.setText(QCoreApplication.translate("Form", u"<html><head/><body><p><span style=\" color:#1a0ec1;\">TextLabel</span></p></body></html>", None))
self.groupBox_7.setTitle(QCoreApplication.translate("Form", u"Main", None))
self.pushButton_8.setText(QCoreApplication.translate("Form", u"Open Project", None))
self.label_2.setText(QCoreApplication.translate("Form", u"Recent", None))
Expand All @@ -215,15 +253,19 @@ def retranslateUi(self, Form):
self.groupBox_4.setTitle(QCoreApplication.translate("Form", u"Hello World", None))
self.label_6.setText(QCoreApplication.translate("Form", u" In this guide you will learn two ways of running a \u201cHello, World!\u201d program on Spine Toolbox.", None))
self.pushButton.setText(QCoreApplication.translate("Form", u"Open Document", None))
self.label_10.setText("")
self.groupBox_10.setTitle(QCoreApplication.translate("Form", u"Introduction to Spine Data Structure", None))
self.label_7.setText(QCoreApplication.translate("Form", u"Learn more on the Spine Data Structure through this GitHub document.", None))
self.pushButton_2.setText(QCoreApplication.translate("Form", u"Open Document", None))
self.label_11.setText("")
self.groupBox_11.setTitle(QCoreApplication.translate("Form", u"Setting up a Workflow", None))
self.label_8.setText(QCoreApplication.translate("Form", u"This documento will show how to add a Tool item to your project.", None))
self.pushButton_4.setText(QCoreApplication.translate("Form", u"Open Document", None))
self.label_15.setText("")
self.groupBox_13.setTitle(QCoreApplication.translate("Form", u"Executing Projects", None))
self.label_9.setText(QCoreApplication.translate("Form", u"This document describes how executing a project works and what resources are passed between project items at execution time.", None))
self.pushButton_5.setText(QCoreApplication.translate("Form", u"Open Document", None))
self.label_16.setText("")
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("Form", u"Learning materials", None))
self.label.setText(QCoreApplication.translate("Form", u"Spine Toolbox", None))
self.label_13.setText(QCoreApplication.translate("Form", u"Model specific workflows", None))
Expand Down
Loading

0 comments on commit d118f7b

Please sign in to comment.