Skip to content

Commit

Permalink
Add links to open the learning materials
Browse files Browse the repository at this point in the history
  • Loading branch information
ermannolocascio committed Sep 9, 2024
1 parent 8329d86 commit 6d07c3b
Show file tree
Hide file tree
Showing 3 changed files with 206 additions and 26 deletions.
48 changes: 43 additions & 5 deletions spinetoolbox/ui/startup_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,43 @@ def setupUi(self, Form):
self.groupBox_4 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_4.setObjectName(u"groupBox_4")
self.groupBox_4.setGeometry(QRect(10, 50, 631, 101))
self.label_6 = QLabel(self.groupBox_4)
self.label_6.setObjectName(u"label_6")
self.label_6.setGeometry(QRect(90, 25, 401, 61))
self.label_6.setWordWrap(True)
self.pushButton = QPushButton(self.groupBox_4)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setGeometry(QRect(510, 46, 101, 20))
self.groupBox_10 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_10.setObjectName(u"groupBox_10")
self.groupBox_10.setGeometry(QRect(10, 170, 631, 111))
self.label_7 = QLabel(self.groupBox_10)
self.label_7.setObjectName(u"label_7")
self.label_7.setGeometry(QRect(90, 30, 401, 61))
self.label_7.setWordWrap(True)
self.pushButton_2 = QPushButton(self.groupBox_10)
self.pushButton_2.setObjectName(u"pushButton_2")
self.pushButton_2.setGeometry(QRect(510, 52, 101, 21))
self.groupBox_11 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_11.setObjectName(u"groupBox_11")
self.groupBox_11.setGeometry(QRect(10, 300, 631, 101))
self.label_8 = QLabel(self.groupBox_11)
self.label_8.setObjectName(u"label_8")
self.label_8.setGeometry(QRect(100, 25, 381, 61))
self.label_8.setWordWrap(True)
self.pushButton_4 = QPushButton(self.groupBox_11)
self.pushButton_4.setObjectName(u"pushButton_4")
self.pushButton_4.setGeometry(QRect(510, 48, 101, 21))
self.groupBox_13 = QGroupBox(self.scrollAreaWidgetContents_3)
self.groupBox_13.setObjectName(u"groupBox_13")
self.groupBox_13.setGeometry(QRect(10, 460, 631, 101))
self.label_9 = QLabel(self.groupBox_13)
self.label_9.setObjectName(u"label_9")
self.label_9.setGeometry(QRect(100, 25, 391, 51))
self.label_9.setWordWrap(True)
self.pushButton_5 = QPushButton(self.groupBox_13)
self.pushButton_5.setObjectName(u"pushButton_5")
self.pushButton_5.setGeometry(QRect(510, 40, 101, 21))
self.scrollArea_2.setWidget(self.scrollAreaWidgetContents_3)
self.tabWidget.addTab(self.tab_2, "")
self.tab = QWidget()
Expand All @@ -129,12 +157,12 @@ def setupUi(self, Form):
self.label.setLayoutDirection(Qt.LeftToRight)
self.label_13 = QLabel(self.scrollAreaWidgetContents_2)
self.label_13.setObjectName(u"label_13")
self.label_13.setGeometry(QRect(10, 240, 621, 21))
self.label_13.setGeometry(QRect(10, 280, 621, 21))
self.label_13.setFont(font)
self.label_13.setLayoutDirection(Qt.LeftToRight)
self.groupBox_8 = QGroupBox(self.scrollAreaWidgetContents_2)
self.groupBox_8.setObjectName(u"groupBox_8")
self.groupBox_8.setGeometry(QRect(10, 60, 631, 131))
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))
Expand All @@ -146,7 +174,7 @@ def setupUi(self, Form):
self.pushButton_3.setGeometry(QRect(460, 50, 141, 24))
self.groupBox_3 = QGroupBox(self.scrollAreaWidgetContents_2)
self.groupBox_3.setObjectName(u"groupBox_3")
self.groupBox_3.setGeometry(QRect(10, 320, 631, 131))
self.groupBox_3.setGeometry(QRect(10, 340, 631, 131))
self.pushButton_7 = QPushButton(self.groupBox_3)
self.pushButton_7.setObjectName(u"pushButton_7")
self.pushButton_7.setGeometry(QRect(470, 50, 121, 24))
Expand All @@ -158,7 +186,9 @@ def setupUi(self, Form):
self.label_12.setWordWrap(True)
self.label_4 = QLabel(self.scrollAreaWidgetContents_2)
self.label_4.setObjectName(u"label_4")
self.label_4.setGeometry(QRect(10, 280, 631, 31))
self.label_4.setGeometry(QRect(20, 50, 531, 31))
self.label_4.setAutoFillBackground(False)
self.label_4.setTextFormat(Qt.RichText)
self.scrollArea.setWidget(self.scrollAreaWidgetContents_2)

self.verticalLayout_3.addWidget(self.scrollArea)
Expand All @@ -183,9 +213,17 @@ def retranslateUi(self, Form):
self.label_3.setText(QCoreApplication.translate("Form", u"Introductory Learning Material", None))
self.label_14.setText(QCoreApplication.translate("Form", u"Advanced Learning Material", None))
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.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.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.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.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 All @@ -195,7 +233,7 @@ def retranslateUi(self, Form):
self.groupBox_3.setTitle(QCoreApplication.translate("Form", u"SpineOpt - Simple Energy System", None))
self.pushButton_7.setText(QCoreApplication.translate("Form", u"Open", None))
self.label_12.setText(QCoreApplication.translate("Form", u"This tutorial provides a step-by-step guide to setup a simple energy system with Spine Toolbox for SpineOpt. Spine Toolbox is used to create a workflow with databases and tools and SpineOpt is the tool that simulates/optimizes the energy system.", None))
self.label_4.setText(QCoreApplication.translate("Form", u"Prerequisite to run the and Julia, SpineOpt", None))
self.label_4.setText(QCoreApplication.translate("Form", u"<html><head/><body><p>Prerequisites: To run the following project templates, make sure to install both Julia and SpineOpt.</p></body></html>", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("Form", u"Templates", None))
# retranslateUi

151 changes: 130 additions & 21 deletions spinetoolbox/ui/startup_box.ui
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# Copyright Spine Toolbox contributors
# This file is part of Spine Toolbox.
# Spine Toolbox is free software: you can redistribute it and\/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)
# any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details. You should have received a copy of the GNU Lesser General Public License along with
# this program. If not, see <http:\/\/www.gnu.org\/licenses\/>.
######################################################################################################################
-->
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
Expand Down Expand Up @@ -244,6 +231,35 @@ border-color: rgb(240, 240, 240);</string>
<property name="title">
<string>Hello World</string>
</property>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>90</x>
<y>25</y>
<width>401</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string> In this guide you will learn two ways of running a “Hello, World!” program on Spine Toolbox.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>510</x>
<y>46</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Open Document</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_10">
<property name="geometry">
Expand All @@ -257,6 +273,35 @@ border-color: rgb(240, 240, 240);</string>
<property name="title">
<string>Introduction to Spine Data Structure</string>
</property>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>401</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>Learn more on the Spine Data Structure through this GitHub document.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>510</x>
<y>52</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Open Document</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_11">
<property name="geometry">
Expand All @@ -270,6 +315,35 @@ border-color: rgb(240, 240, 240);</string>
<property name="title">
<string>Setting up a Workflow</string>
</property>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>100</x>
<y>25</y>
<width>381</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>This documento will show how to add a Tool item to your project.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>510</x>
<y>48</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Open Document</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_13">
<property name="geometry">
Expand All @@ -283,8 +357,37 @@ border-color: rgb(240, 240, 240);</string>
<property name="title">
<string>Executing Projects</string>
</property>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>100</x>
<y>25</y>
<width>391</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>This document describes how executing a project works and what resources are passed between project items at execution time.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton_5">
<property name="geometry">
<rect>
<x>510</x>
<y>40</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Open Document</string>
</property>
</widget>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab">
Expand Down Expand Up @@ -345,7 +448,7 @@ border-color: rgb(240, 240, 240);</string>
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<y>280</y>
<width>621</width>
<height>21</height>
</rect>
Expand All @@ -368,7 +471,7 @@ border-color: rgb(240, 240, 240);</string>
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<y>120</y>
<width>631</width>
<height>131</height>
</rect>
Expand Down Expand Up @@ -416,7 +519,7 @@ border-color: rgb(240, 240, 240);</string>
<property name="geometry">
<rect>
<x>10</x>
<y>320</y>
<y>340</y>
<width>631</width>
<height>131</height>
</rect>
Expand Down Expand Up @@ -463,14 +566,20 @@ border-color: rgb(240, 240, 240);</string>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>631</width>
<x>20</x>
<y>50</y>
<width>531</width>
<height>31</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string>Prerequisite to run the and Julia, SpineOpt</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Prerequisites: To run the following project templates, make sure to install both Julia and SpineOpt.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</widget>
Expand Down
33 changes: 33 additions & 0 deletions spinetoolbox/widgets/startup_box_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from PySide6.QtCore import Qt, Slot, Signal
from spinetoolbox.ui.startup_box import Ui_Form
from PySide6.QtWidgets import QListWidgetItem
import webbrowser


class StartupBoxWidget(QWidget):
Expand Down Expand Up @@ -44,6 +45,18 @@ def __init__(self, parent=None):
self._ui.pushButton_3.clicked.connect(self.open_tutorial1)
self._ui.pushButton_7.clicked.connect(self.open_tutorial5)

# Connect the clicked button to open the link1
self._ui.pushButton.clicked.connect(self.open_link1)

# Connect the clicked button to open the link2
self._ui.pushButton_2.clicked.connect(self.open_link2)

# Connect the clicked button to open the link3
self._ui.pushButton_4.clicked.connect(self.open_link3)

# Connect the clicked button to open the link4
self._ui.pushButton_5.clicked.connect(self.open_link4)

def set_changelog_diff(self, diff_list):
# Add diff_list items to listWidget_2
for item in diff_list:
Expand Down Expand Up @@ -88,6 +101,26 @@ def open_selected_tutorial(self):
path = item.data(Qt.UserRole)
self.project_load_requested.emit(path)



def open_link1(self):
print("Open link")
webbrowser.open_new_tab("https://spine-toolbox.readthedocs.io/en/latest/getting_started.html")

def open_link2(self):
print("Open link")
webbrowser.open_new_tab("https://github.com/energy-modelling-workbench/spine-data-model#spine-data-model")

def open_link3(self):
print("Open link")
webbrowser.open_new_tab("https://spine-toolbox.readthedocs.io/en/latest/getting_started.html#adding-a-data-connection-item-to-the-project")

def open_link4(self):
print("Open link")
webbrowser.open_new_tab("https://spine-toolbox.readthedocs.io/en/latest/executing_projects.html")



def open_tutorial1(self):
print("Open 1st tutorial")
path_to_project = "C:\\Users\ErmannoLoCascio\Desktop\eScience - Mopo\spine_projects\Simple Tutorial 4"
Expand Down

0 comments on commit 6d07c3b

Please sign in to comment.