Skip to content

Commit

Permalink
nice box in gui and text
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Oct 25, 2024
1 parent 848ce17 commit 5db55f5
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 50 deletions.
34 changes: 26 additions & 8 deletions QgisModelBaker/gui/workflow_wizard/project_creation_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __init__(self, parent, title):
self.fileValidator = gui_utils.FileValidator(
pattern=["*." + ext for ext in self.ValidExtensions], allow_empty=False
)
self.gpkg_multigeometry_info.setVisible(False)
self.gpkg_multigeometry_frame.setVisible(False)

def isComplete(self):
return self.is_complete
Expand Down Expand Up @@ -127,7 +127,7 @@ def restore_configuration(self, configuration):
else:
self._use_existing(False)

self.gpkg_multigeometry_info.setVisible(self._multigeom_gpkg())
self.gpkg_multigeometry_frame.setVisible(self._multigeom_gpkg())

self.workflow_wizard.busy(self, False)

Expand Down Expand Up @@ -726,14 +726,32 @@ def _multigeom_gpkg(self):
return False

if int(gdal.VersionInfo("VERSION_NUM")) < 3080000:
# if our GDAL is not able to handle, we tell it and maybe block the project creation
self.gpkg_multigeometry_info.setText("<b>Oh oh, this is not gonna work</b>")
self.gpkg_multigeometry_label.setText(
"""
<html><head/><body style="background-color:powderblue;">
<p><b>This GeoPackage contains at least one table with multiple geometries</b></p>
<p>These tables require <span style=" font-weight:600;">GDAL version &gt;= 3.8</span> to run in QGIS.<br/>Your current QGIS version is <span style=" font-weight:600;">{qgis_version}</span> with GDAL <span style=" font-weight:600;">{gdal_version}</span>.</p>
<p>Means this won't work.</p>
</body></html>
""".format(
qgis_version=Qgis.QGIS_VERSION,
gdal_version=gdal.VersionInfo("RELEASE_NAME"),
)
)
self.create_project_button.setDisabled(True)
else:
# if our GDAL is able to handle, we give a warning that others might not be able to read the project
self.gpkg_multigeometry_info.setText(
"<b>It's gonna work but be aware of...</b>"
self.gpkg_multigeometry_label.setText(
"""
<html><head/><body style="background-color:powderblue;">
<p><b>This GeoPackage contains at least one table with multiple geometries</b></p>
<p>These tables require <span style=" font-weight:600;">GDAL version &gt;= 3.8</span> to run in QGIS.<br/>Your current QGIS version is <span style=" font-weight:600;">{qgis_version}</span> with GDAL <span style=" font-weight:600;">{gdal_version}</span>.</p>
<p>But note that others with lower 3.8 version <span style=" font-weight:600;">will not be able </span>to read such tables in the created QGIS project.</p>
</body></html>
""".format(
qgis_version=Qgis.QGIS_VERSION,
gdal_version=gdal.VersionInfo("RELEASE_NAME"),
)
)

return True

def _multiple_geometry_gpkg_table(self):
Expand Down
105 changes: 63 additions & 42 deletions QgisModelBaker/ui/workflow_wizard/project_creation.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@
<string>Select Files</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="description">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Generate a QGIS Project from an existing database.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCommandLinkButton" name="create_project_button">
<property name="text">
Expand Down Expand Up @@ -99,44 +124,6 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="description">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Generate a QGIS Project from an existing database.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="inheritance_groupbox">
<property name="title">
Expand Down Expand Up @@ -197,11 +184,45 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="gpkg_multigeometry_info">
<property name="text">
<string>GPKG info</string>
<item row="6" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<widget class="QFrame" name="gpkg_multigeometry_frame">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 200, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="gpkg_multigeometry_label">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>GPKG info</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 5db55f5

Please sign in to comment.