Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(ui): add PROJ and Tkinter versions to credits #303

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 39 additions & 17 deletions dicogis/ui/tab_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"""
Name: TabCredits
Purpose: Tab containing credits and licencse informations in DicoGIS Notebook.
Purpose: Tab containing credits and license informations in DicoGIS Notebook.

Author: Julien Moura (@geojulien)
"""
Expand All @@ -15,14 +15,16 @@
# Standard library
import logging
import platform
from tkinter import ACTIVE, DISABLED, Tk
from tkinter import ACTIVE, DISABLED, Tk, TkVersion
from tkinter.ttk import Frame, Label

# 3rd party
from lxml import __version__ as lxml_version
from numpy import __version__ as numpy_version
from openpyxl import __version__ as openpyxl_version
from osgeo import __version__ as gdal_version

# project
from dicogis.utils.environment import get_gdal_version, get_proj_version

# ##############################################################################
# ############ Globals ############
Expand All @@ -37,8 +39,18 @@


class TabCredits(Frame):
def __init__(self, parent, txt={}, switcher=None):
"""Instanciating the output workbook."""
"""Tab displaying project credits. Displayed during data processing.

Args:
Frame: inherited ttk.Frame
"""

def __init__(self, parent):
"""UI tab for databases initialization.

Args:
parent: tkinter parent object
"""
self.parent = parent
Frame.__init__(self)

Expand All @@ -50,7 +62,11 @@ def __init__(self, parent, txt={}, switcher=None):
# -- Widgets definition --------------------------------------------------------
# GDAL
self.cred_lb_gdal_name = Label(self.FrCreditsVersions, text="GDAL")
self.cred_lb_gdal_value = Label(self.FrCreditsVersions, text=gdal_version)
self.cred_lb_gdal_value = Label(self.FrCreditsVersions, text=get_gdal_version())

# PROJ
self.cred_lb_proj_name = Label(self.FrCreditsVersions, text="PROJ")
self.cred_lb_proj_value = Label(self.FrCreditsVersions, text=get_proj_version())

# LXML
self.cred_lb_lxml_name = Label(self.FrCreditsVersions, text="LXML")
Expand All @@ -66,6 +82,10 @@ def __init__(self, parent, txt={}, switcher=None):
self.FrCreditsVersions, text=openpyxl_version
)

# Tkinter
self.cred_lb_tkinter_name = Label(self.FrCreditsVersions, text="Tkinter (Tk)")
self.cred_lb_tkinter_value = Label(self.FrCreditsVersions, text=TkVersion)

# Python
self.cred_lb_python_name = Label(self.FrCreditsVersions, text="Python")
self.cred_lb_python_value = Label(
Expand All @@ -75,14 +95,18 @@ def __init__(self, parent, txt={}, switcher=None):
# -- Widgets placement ---------------------------------------------------------
self.cred_lb_gdal_name.grid(row=0, column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_gdal_value.grid(row=0, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_lxml_name.grid(row=1, column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_lxml_value.grid(row=1, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_numpy_name.grid(row=2, column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_numpy_value.grid(row=2, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_openpyxl_name.grid(row=3, column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_openpyxl_value.grid(row=3, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_python_name.grid(row=4, column=0, sticky="WE", padx=3, pady=2)
self.cred_lb_python_value.grid(row=4, column=1, sticky="WE", padx=3, pady=2)
self.cred_lb_proj_name.grid(column=0, sticky="WE", padx=3, pady=2)
self.cred_lb_proj_value.grid(row=1, column=1, sticky="WE", padx=3, pady=2)
self.cred_lb_lxml_name.grid(column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_lxml_value.grid(row=2, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_numpy_name.grid(column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_numpy_value.grid(row=3, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_openpyxl_name.grid(column=0, sticky="WE", padx=2, pady=2)
self.cred_lb_openpyxl_value.grid(row=4, column=1, sticky="WE", padx=2, pady=2)
self.cred_lb_tkinter_name.grid(column=0, sticky="WE", padx=3, pady=2)
self.cred_lb_tkinter_value.grid(row=5, column=1, sticky="WE", padx=3, pady=2)
self.cred_lb_python_name.grid(column=0, sticky="WE", padx=3, pady=2)
self.cred_lb_python_value.grid(row=6, column=1, sticky="WE", padx=3, pady=2)


# #############################################################################
Expand All @@ -104,11 +128,9 @@ def ui_switch(cb_value, parent):
else:
for child in parent.winfo_children():
child.configure(state=DISABLED)
# end of function
return

# try it
root = Tk()
frame = TabCredits(root, switcher=ui_switch)
frame = TabCredits(parent=root)
frame.pack()
root.mainloop()
Loading