commit 86e1baf89a50463d183562ffc05e9993a292a843 Author: yutent Date: Mon Jan 8 17:03:37 2024 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..17628fb --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +.DS_Store +.AppleDouble +.LSOverride +.idea +._* + +*.deb +.Spotlight-V100 +.Trashes + +we +__pycache__ +*.txt \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..ed41dcd --- /dev/null +++ b/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +if [ -d unpack ]; then + sudo rm -rf unpack +fi + +version="3.0.4" + +mkdir -p unpack/DEBIAN + +cp debian/control unpack/DEBIAN/ +cp -r usr unpack/ + +mkdir -p unpack/usr/share/icons/hicolor/128x128/apps +mkdir -p unpack/usr/share/icons/hicolor/256x256/apps + +cp icons/128x128.png unpack/usr/share/icons/hicolor/128x128/apps/dooke.png +cp icons/256x256.png unpack/usr/share/icons/hicolor/256x256/apps/dooke.png + +cd unpack +find usr -type f | xargs md5sum > DEBIAN/md5sums + +_size=$(du -d 0 usr | cut -f1) + +sed -i "s/{{size}}/${_size}/" DEBIAN/control +sed -i "s/{{version}}/${version}/" DEBIAN/control + +cd .. +sudo chown -R root:root unpack/ +dpkg-deb -b unpack/ "dooke-${version}.deb" + +sudo rm -rf unpack \ No newline at end of file diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..a73c727 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Package: dooke +Version: {{version}} +Section: develop +Architecture: all +Priority: optional +Maintainer: Yutent +Installed-Size: {{size}} +Depends: python3-webengine-gtk3 (>=0.6.1) +Homepage: https://git.wkit.fun/appcat/dooke +Author: yutent +Description: docker管理面板。 + 提供了一个类似官网docker desktop的管理面板. diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..fa90b77 --- /dev/null +++ b/test.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +export RUN_ENV='development' + + +./usr/lib/dooke/dooke.py + diff --git a/usr/bin/dooke b/usr/bin/dooke new file mode 100644 index 0000000..57b355a --- /dev/null +++ b/usr/bin/dooke @@ -0,0 +1,3 @@ +#!/bin/bash + +/usr/lib/dooke/dooke.py \ No newline at end of file diff --git a/usr/lib/dooke/_window.py b/usr/lib/dooke/_window.py new file mode 100644 index 0000000..859da12 --- /dev/null +++ b/usr/lib/dooke/_window.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import gi + +gi.require_version('Gtk', '3.0') + +from gi.repository import Gtk + +class Window(Gtk.Window): + def __init__(self, title = 'Untitled window', width = 840, height = 520): + Gtk.Window.__init__(self, title = title) + self.set_default_size(width, height) + self.resize(width, height) + self.set_wmclass('Dooke', 'Dooke') + self.set_title('Dooke') + + + def toggle_visible(self, icon): + if self.is_visible(): + self.hide() + else: + self.present() \ No newline at end of file diff --git a/usr/lib/dooke/dooke.py b/usr/lib/dooke/dooke.py new file mode 100644 index 0000000..555b584 --- /dev/null +++ b/usr/lib/dooke/dooke.py @@ -0,0 +1,67 @@ +#!/usr/bin/python3 + +import gi, os, sys + +gi.require_version('Gtk', '3.0') + +from gi.repository import Gtk, Gdk, GLib, Gio, GObject, GdkPixbuf + +from webengine.gtk3 import WebEngine, create_setting, create_hmr_server +from _window import Window + +APP_ID = 'fun.wkit.dooke' +__dir__ = os.path.dirname(os.path.realpath(__file__)) + +web_root = os.path.join(__dir__, './webapp') +home_dir = os.getenv('HOME') +config_dir = os.path.join(home_dir, '.config/dooke') + + +if not os.path.isdir(config_dir): + os.mkdir(config_dir) + + +class Application(Gtk.Application): + def __init__(self): + + Gtk.Application.__init__(self, application_id = APP_ID) + + self.window = Window() + + web = WebEngine(self.window) + web.set_root(web_root) + + if os.getenv('RUN_ENV') == 'development': + setting = create_setting({"devtools": True}) + hmr = create_hmr_server() + web.use(setting).use(hmr) + + web.connect('quit', self.quit_all) + web.load() + + self.window.add(web) + + + + def do_activate(self): + + self.set_app_menu(None) + self.set_menubar(None) + + self.add_window(self.window) + self.window.show_all() + + + def quit_all(self, widget): + self.remove_window(self.window) + + + + +if __name__ == "__main__": + try: + app = Application() + app.run(sys.argv) + except Exception as err: + print(err) + diff --git a/usr/share/applications/dooke.desktop b/usr/share/applications/dooke.desktop new file mode 100644 index 0000000..ac1d9b4 --- /dev/null +++ b/usr/share/applications/dooke.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Dooke +Comment[zh_CN]=Docker 面板 +Exec=dooke +Icon=dooke +Terminal=false +X-MultipleArgs=false +Type=Application +Categories=Development; \ No newline at end of file