Skip to content

Commit

Permalink
Use SVG icons (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sommer committed Jun 2, 2023
1 parent e216555 commit fa3851e
Show file tree
Hide file tree
Showing 93 changed files with 534 additions and 202 deletions.
9 changes: 6 additions & 3 deletions LICENSE.txt
Expand Up @@ -28,15 +28,18 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Icons
=====

The icons and materials included in the project are released under the Creative
Commons Attribution 4.0 International Public License (CC BY 4.0) available on
https://creativecommons.org/licenses/by/4.0/.

Some icons are based on the free GLYPHICONS (https://glyphicons.com/) by Jan
Kovarik released under the Creative Commons Attribution 3.0 Unported (CC BY 3.0)
license available on https://creativecommons.org/licenses/by/3.0/.
Some icons are based on Bootstrap Icons (https://github.com/twbs/icons) released under
the MIT license (https://github.com/twbs/icons/blob/main/LICENSE).

Some icons are based on Font Awesome Free Icons (https://github.com/twbs/icons) released under
the CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/).

FMI Header and Model Description Schema files
==================================================
Expand Down
11 changes: 7 additions & 4 deletions fmpy/gui/MainWindow.py
Expand Up @@ -12,7 +12,7 @@
import sys

from PyQt5.QtCore import QCoreApplication, QDir, Qt, pyqtSignal, QUrl, QSettings, QPoint, QTimer, QStandardPaths, \
QPointF, QBuffer, QIODevice
QPointF, QBuffer, QIODevice, QSize
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QLineEdit, QComboBox, QFileDialog, QLabel, QVBoxLayout, \
QMenu, QMessageBox, QProgressDialog, QProgressBar, QDialog, QGraphicsScene, QGraphicsItemGroup, QGraphicsRectItem, \
QGraphicsTextItem, QGraphicsPathItem, QFileSystemModel
Expand Down Expand Up @@ -91,6 +91,8 @@ def __init__(self, parent=None):
# save from garbage collection
self.windows.append(self)

QIcon.setThemeName('light')

# state
self.filename = None
self.unzipdir = None
Expand Down Expand Up @@ -783,7 +785,7 @@ def startSimulation(self):
debugLogging=self.ui.debugLoggingCheckBox.isChecked(),
fmiLogging=self.ui.logFMICallsCheckBox.isChecked())

self.ui.actionSimulate.setIcon(QIcon(':/icons/stop.png'))
self.ui.actionSimulate.setIcon(QIcon(':/icons/light/stop.svg'))
self.ui.actionSimulate.setToolTip("Stop simulation")
self.ui.actionSimulate.triggered.disconnect(self.startSimulation)
self.ui.actionSimulate.triggered.connect(self.simulationThread.stop)
Expand All @@ -809,7 +811,7 @@ def simulationFinished(self):
# update UI
self.ui.actionSimulate.triggered.disconnect(self.simulationThread.stop)
self.ui.actionSimulate.triggered.connect(self.startSimulation)
self.ui.actionSimulate.setIcon(QIcon(':/icons/play.png'))
self.ui.actionSimulate.setIcon(QIcon(':/icons/light/play.svg'))
self.ui.actionSimulate.setToolTip("Start simulation")
self.plotUpdateTimer.stop()
self.simulationProgressBar.setVisible(False)
Expand Down Expand Up @@ -917,7 +919,8 @@ def hideAllColumns(self):
def setStatusMessage(self, level, text):

if level in ['debug', 'info', 'warning', 'error']:
self.statusIconLabel.setPixmap(QPixmap(':/icons/%s-16x16.png' % level))
icon = QIcon(':/icons/light/%s.svg' % level)
self.statusIconLabel.setPixmap(icon.pixmap(QSize(16, 16)))
else:
self.statusIconLabel.setPixmap(QPixmap())

Expand Down
1 change: 1 addition & 0 deletions fmpy/gui/__main__.py
Expand Up @@ -14,6 +14,7 @@
ctypes.windll.shcore.SetProcessDpiAwareness(True)

QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)

app = QApplication(sys.argv)
window = MainWindow()
Expand Down
123 changes: 60 additions & 63 deletions fmpy/gui/forms/MainWindow.ui
Expand Up @@ -84,9 +84,6 @@
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/app_icon.ico</normaloff>:/icons/app_icon.ico</iconset>
</property>
<property name="unifiedTitleAndToolBarOnMac">
<bool>true</bool>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<property name="leftMargin">
Expand All @@ -108,9 +105,22 @@
</property>
<widget class="QWidget" name="startPage">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>15</number>
</property>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
Expand Down Expand Up @@ -139,39 +149,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="pixmap">
<pixmap resource="../icons/icons.qrc">:/icons/start-background.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -215,6 +192,10 @@
<property name="text">
<string>open an FMU</string>
</property>
<property name="icon">
<iconset theme="folder-open">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item>
Expand All @@ -233,6 +214,22 @@
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="minimumSize">
Expand Down Expand Up @@ -1200,7 +1197,7 @@ QToolButton:checked, QToolButton:hover:pressed {
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/debug-16x16.png</normaloff>:/icons/debug-16x16.png</iconset>
<normaloff>:/icons/light/debug.svg</normaloff>:/icons/light/debug.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand All @@ -1226,7 +1223,7 @@ QToolButton:checked, QToolButton:hover:pressed {
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/info-16x16.png</normaloff>:/icons/info-16x16.png</iconset>
<normaloff>:/icons/light/info.svg</normaloff>:/icons/light/info.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand All @@ -1252,7 +1249,7 @@ QToolButton:checked, QToolButton:hover:pressed {
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/warning-16x16.png</normaloff>:/icons/warning-16x16.png</iconset>
<normaloff>:/icons/light/warning.svg</normaloff>:/icons/light/warning.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand All @@ -1278,7 +1275,7 @@ QToolButton:checked, QToolButton:hover:pressed {
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/error-16x16.png</normaloff>:/icons/error-16x16.png</iconset>
<normaloff>:/icons/light/error.svg</normaloff>:/icons/light/error.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down Expand Up @@ -1541,8 +1538,8 @@ QToolButton::menu-button {
<string>...</string>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/filter.png</normaloff>:/icons/filter.png</iconset>
<iconset theme="filter">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand All @@ -1567,8 +1564,8 @@ QToolButton::menu-button {
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/list-16x16.png</normaloff>:/icons/list-16x16.png</iconset>
<iconset theme="list">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down Expand Up @@ -1681,8 +1678,8 @@ QToolButton::menu-button {
</widget>
<action name="actionSimulate">
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/play.png</normaloff>:/icons/play.png</iconset>
<iconset theme="play">
<normaloff>:/icons/play.svg</normaloff>:/icons/play.svg</iconset>
</property>
<property name="text">
<string>Simulate</string>
Expand All @@ -1696,8 +1693,8 @@ QToolButton::menu-button {
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/settings.png</normaloff>:/icons/settings.png</iconset>
<iconset theme="gear">
<normaloff>:/icons/gear.svg</normaloff>:/icons/gear.svg</iconset>
</property>
<property name="text">
<string>Settings</string>
Expand All @@ -1708,8 +1705,8 @@ QToolButton::menu-button {
</action>
<action name="actionOpen">
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/folder_open.png</normaloff>:/icons/folder_open.png</iconset>
<iconset theme="folder-open">
<normaloff>:/icons/folder-open.svg</normaloff>:/icons/folder-open.svg</iconset>
</property>
<property name="text">
<string>&amp;Open</string>
Expand All @@ -1726,8 +1723,8 @@ QToolButton::menu-button {
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/stats.png</normaloff>:/icons/stats.png</iconset>
<iconset theme="graph">
<normaloff>:/icons/graph.svg</normaloff>:/icons/graph.svg</iconset>
</property>
<property name="text">
<string>Results</string>
Expand Down Expand Up @@ -1861,8 +1858,8 @@ QToolButton::menu-button {
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/log.png</normaloff>:/icons/log.png</iconset>
<iconset theme="list-task">
<normaloff>:/icons/list-task.svg</normaloff>:/icons/list-task.svg</iconset>
</property>
<property name="text">
<string>Log</string>
Expand Down Expand Up @@ -1925,8 +1922,8 @@ QToolButton::menu-button {
</action>
<action name="actionReload">
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/reload-16x16.png</normaloff>:/icons/reload-16x16.png</iconset>
<iconset theme="arrow-clockwise">
<normaloff>:/icons/arrow-clockwise.svg</normaloff>:/icons/arrow-clockwise.svg</iconset>
</property>
<property name="text">
<string>&amp;Reload</string>
Expand Down Expand Up @@ -2047,8 +2044,8 @@ QToolButton::menu-button {
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/documentation.png</normaloff>:/icons/documentation.png</iconset>
<iconset theme="book">
<normaloff>:/icons/book.svg</normaloff>:/icons/book.svg</iconset>
</property>
<property name="text">
<string>Show documentation</string>
Expand All @@ -2059,8 +2056,8 @@ QToolButton::menu-button {
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/files.png</normaloff>:/icons/files.png</iconset>
<iconset theme="file-earmark-zip">
<normaloff>:/icons/file-earmark-zip.svg</normaloff>:/icons/file-earmark-zip.svg</iconset>
</property>
<property name="text">
<string>Show archive contents</string>
Expand Down
Binary file removed fmpy/gui/icons/binary_input.png
Binary file not shown.
Binary file removed fmpy/gui/icons/binary_output.png
Binary file not shown.
Binary file removed fmpy/gui/icons/binary_parameter.png
Binary file not shown.
Binary file removed fmpy/gui/icons/binary_variable.png
Binary file not shown.
Binary file removed fmpy/gui/icons/boolean.png
Binary file not shown.
Binary file removed fmpy/gui/icons/boolean_input.png
Binary file not shown.
Binary file removed fmpy/gui/icons/boolean_output.png
Binary file not shown.
Binary file removed fmpy/gui/icons/boolean_parameter.png
Binary file not shown.
Binary file removed fmpy/gui/icons/boolean_variable.png
Binary file not shown.
Binary file removed fmpy/gui/icons/debug-16x16.png
Binary file not shown.
Binary file removed fmpy/gui/icons/documentation.png
Binary file not shown.
Binary file removed fmpy/gui/icons/down_arrow.png
Binary file not shown.
Binary file removed fmpy/gui/icons/enumeration.png
Binary file not shown.
Binary file removed fmpy/gui/icons/enumeration_input.png
Binary file not shown.
Binary file removed fmpy/gui/icons/enumeration_output.png
Binary file not shown.
Binary file removed fmpy/gui/icons/error-16x16.png
Binary file not shown.
Binary file removed fmpy/gui/icons/files.png
Binary file not shown.
Binary file removed fmpy/gui/icons/filter.png
Binary file not shown.
Binary file removed fmpy/gui/icons/float_input.png
Binary file not shown.
Binary file removed fmpy/gui/icons/float_output.png
Binary file not shown.
Binary file removed fmpy/gui/icons/float_parameter.png
Binary file not shown.
Binary file removed fmpy/gui/icons/float_variable.png
Binary file not shown.
Binary file removed fmpy/gui/icons/folder_open.png
Binary file not shown.
Binary file modified fmpy/gui/icons/icons.afdesign
Binary file not shown.

0 comments on commit fa3851e

Please sign in to comment.