aboutsummaryrefslogtreecommitdiff
path: root/ayatanasettings/builder.py
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2024-08-27 14:43:59 +0200
committerRobert Tari <robert@tari.in>2024-08-27 14:43:59 +0200
commit269aa4c7df03e1e581c01866c91bcfa5524d6334 (patch)
tree2fcd022cbfcb82537b15ae334b563cfaf16e5dde /ayatanasettings/builder.py
parent4bfbd579171d9194956376c7153f378ff6eb9d4e (diff)
downloadayatana-settings-269aa4c7df03e1e581c01866c91bcfa5524d6334.tar.gz
ayatana-settings-269aa4c7df03e1e581c01866c91bcfa5524d6334.tar.bz2
ayatana-settings-269aa4c7df03e1e581c01866c91bcfa5524d6334.zip
Rewrite using C/CMake/Gtk4 and add some features/tweaks
Diffstat (limited to 'ayatanasettings/builder.py')
-rw-r--r--ayatanasettings/builder.py80
1 files changed, 0 insertions, 80 deletions
diff --git a/ayatanasettings/builder.py b/ayatanasettings/builder.py
deleted file mode 100644
index 1297ec9..0000000
--- a/ayatanasettings/builder.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-import gi
-
-gi.require_version('Gtk', '3.0')
-
-from gi.repository import Gtk
-from .appdata import APPNAME, APPTITLE, APPDEBUG, APPEXECUTABLE
-import os
-
-def getClassVar(sId):
-
- return 'p' + sId[0:1].upper() + sId[1:]
-
-def getDataPath(sPath):
-
- try:
-
- sExecPath = os.path.split(APPEXECUTABLE)[0]
- sDataPath = os.getcwd().replace(sExecPath, '')
- sRelativePath = os.path.join(sDataPath, sPath.lstrip('/'))
-
- if os.path.exists(sRelativePath):
-
- return sRelativePath
-
- except:
-
- pass
-
- return sPath
-
-def buildApp(pApp):
-
- pBuilder = Gtk.Builder()
- pBuilder.set_translation_domain(APPNAME)
- pBuilder.add_from_file(getDataPath('/usr/share/' + APPNAME + '/' + APPNAME + '.glade'))
- pBuilder.connect_signals(pApp)
-
- for pObject in pBuilder.get_objects():
-
- try:
-
- pApp.__dict__[getClassVar(Gtk.Buildable.get_name(pObject))] = pObject
-
- if isinstance(pObject, Gtk.Notebook):
-
- def onNotebookPageSelected(pWidget, pEvent):
-
- nMouseX, nMouseY = pEvent.get_coords()
-
- for nPage in range(0, pWidget.get_n_pages()):
-
- pLabel = pWidget.get_tab_label(pWidget.get_nth_page(nPage))
- nX, nY = pLabel.translate_coordinates(pWidget, 0, 0)
- rcSize = pLabel.get_allocation()
-
- if nMouseX >= nX and nMouseY >= nY and nMouseX <= nX + rcSize.width and nMouseY <= nY + rcSize.height and pWidget.get_tab_label(pWidget.get_nth_page(nPage)).get_sensitive():
-
- return False
-
- return True
-
- pObject.connect('button-press-event', onNotebookPageSelected)
-
- except:
-
- pass
-
- pApp.pWindow.set_icon_from_file(getDataPath('/usr/share/icons/hicolor/scalable/apps/' + APPNAME + '.svg'))
-
- sTitle = APPTITLE
-
- if APPDEBUG:
-
- sTitle += ' - DEBUGGING MODE'
-
- pApp.pWindow.set_title(sTitle)
- pApp.pWindow.show_all()