master
yutent 2024-01-08 17:03:37 +08:00
commit 86e1baf89a
8 changed files with 165 additions and 0 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
.DS_Store
.AppleDouble
.LSOverride
.idea
._*
*.deb
.Spotlight-V100
.Trashes
we
__pycache__
*.txt

32
build.sh Normal file
View File

@ -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

12
debian/control vendored Normal file
View File

@ -0,0 +1,12 @@
Package: dooke
Version: {{version}}
Section: develop
Architecture: all
Priority: optional
Maintainer: Yutent <yutent.io@gmail.com>
Installed-Size: {{size}}
Depends: python3-webengine-gtk3 (>=0.6.1)
Homepage: https://git.wkit.fun/appcat/dooke
Author: yutent
Description: docker管理面板。
提供了一个类似官网docker desktop的管理面板.

7
test.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
export RUN_ENV='development'
./usr/lib/dooke/dooke.py

3
usr/bin/dooke Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/usr/lib/dooke/dooke.py

22
usr/lib/dooke/_window.py Normal file
View File

@ -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()

67
usr/lib/dooke/dooke.py Normal file
View File

@ -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)

View File

@ -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;