Repos / mcross / 670eb04f2f
commit 670eb04f2f7af17524df01a05b1c91f0cb1fe929
Author: Bùi Thành Nhân <hi@imnhan.com>
Date: Sat May 16 10:53:31 2020 +0700
os-specific pointer cursors
diff --git a/pyproject.toml b/pyproject.toml
index 93f8340..9efa363 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mcross"
-version = "0.4.0"
+version = "0.4.1"
description = "Do you remember www?"
authors = ["nhanb <hi@imnhan.com>"]
license = "MIT"
diff --git a/src/mcross/gui/view.py b/src/mcross/gui/view.py
index c5c237d..1b0f801 100644
--- a/src/mcross/gui/view.py
+++ b/src/mcross/gui/view.py
@@ -14,6 +14,17 @@
from .model import Model
from .widgets import ReadOnlyText
+# OS-specific values
+if sys.platform == "win32":
+ TTK_THEME = "vista"
+ POINTER_CURSOR = "center_ptr"
+elif sys.platform == "darwin":
+ TTK_THEME = "aqua"
+ POINTER_CURSOR = "pointinghand"
+else:
+ TTK_THEME = "clam"
+ POINTER_CURSOR = "hand1"
+
def pick_font(names):
available = font.families()
@@ -135,19 +146,14 @@ def __init__(self, root: Tk, model: Model):
text_scrollbar.pack(side="left", fill="y")
style = ttk.Style()
- if sys.platform == "win32":
- style.theme_use("vista")
- elif sys.platform == "darwin":
- style.theme_use("aqua")
- else:
- style.theme_use("clam")
+ style.theme_use(TTK_THEME)
def _on_go(self, ev=None):
if self.go_callback is not None:
self.go_callback("gemini://" + self.address_bar.get())
def _on_link_enter(self, ev):
- self.text.config(cursor="hand1")
+ self.text.config(cursor=POINTER_CURSOR)
def _on_link_leave(self, ev):
self.text.config(cursor="xterm")