Skip to content

Commit

Permalink
Merge pull request #27 from ArshavineRoy/feature-clipboard
Browse files Browse the repository at this point in the history
add copy version info in About
  • Loading branch information
ObaraEmmanuel authored Nov 27, 2023
2 parents 5e355cb + a677bf0 commit aa969c7
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion studio/ui/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import sys
import tkinter

from hoverset.ui.widgets import Frame, Label, Application, Hyperlink
from hoverset.ui.widgets import Frame, Label, Application, Hyperlink, Button
from hoverset.ui.dialogs import MessageDialog
from hoverset.data.images import load_tk_image
from hoverset.ui.icons import get_icon_image
from hoverset.data.utils import get_resource_path
from hoverset.util import version_description

Expand Down Expand Up @@ -33,6 +34,18 @@ def __init__(self, parent):
About.Spec(self, "studio version", version_description(studio.__version__))
About.Spec(self, "Platform", platform.platform())

copy_button = Button(
self,
text=" Copy",
height=25,
image=get_icon_image("copy", 20, 20),
compound="left",
**self.style.button,
)
copy_button.pack(side="top", pady=8)
copy_button.configure(width=copy_button.measure_text(" Copy") + 25, **self.style.highlight_active)
copy_button.on_click(self.copy_to_clipboard)

f = Frame(self, **self.style.surface)
f.pack(side="top", padx=10, pady=3)
Hyperlink(
Expand All @@ -51,6 +64,16 @@ def __init__(self, parent):
Label(self, text=copy_right, **self.style.text_passive).pack(side="top", fill="y")
self.pack(fill="both", expand=True)

def copy_to_clipboard(self, _=None):
self.clipboard_clear()
self.clipboard_append(
f"Python: {platform.python_version()} {sys.version_info.releaselevel} {sys.version_info.serial}\n"
f"Tcl/Tk: {tkinter.TkVersion}\n"
f"Loader: {formation.__version__}\n"
f"Studio: {studio.__version__}\n"
f"Platform: {platform.platform()}"
)


def about_window(parent):
dialog = MessageDialog(parent, About)
Expand Down

0 comments on commit aa969c7

Please sign in to comment.