diff --git a/INSTALL b/INSTALL index 5970480..1812834 100644 --- a/INSTALL +++ b/INSTALL @@ -79,32 +79,7 @@ group (here as example 'yms'). The user which runs the local gui (here chgrp yms /var/local/yms/thumb chmod -R 770 /var/local/yms -5. Install webgui - -5.1 Upload webgui files - -Upload all files and directories (except the install directory) to your -webserver. -Disallow access to include files (.inc). There is an example _htaccess -file. - -5.2. Create and edit webgui config file - -Rename sample configfile config.inc-sample: - - mv config.inc-sample config.inc - -Open config.inc in a text editor and fill in your database details. -If you want to use local unix socket connection set host = socket. - -5.3. Check file access rights for security - -Configfile should be readable by webserver but not writeable. - - chmod 640 config.inc - chgrp www-data config.inc - -6. Setup local GUI +4. Setup local GUI Create a local database user with same name as your computer user and allow database access with current unix credentials. E.g if your current unix user @@ -113,8 +88,32 @@ is "ymsgui": mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON yms.* TO 'ymsgui'@'localhost'; Execute "install.sh" to install the software to your local operating system. +This has to be done as user "root" or with "sudo". -Start "yms", default configuration file is automatically created +6. Install webgui + +6.1 Upload webgui files + +Upload all files and directories (except the install directory) to your +webserver. +Disallow access to include files (.inc). There is an example _htaccess +file. + +6.2. Create and edit webgui config file + +Rename sample configfile config.inc-sample: + + mv config.inc-sample config.inc + +Open config.inc in a text editor and fill in your database details. +If you want to use local unix socket connection set host = socket. + +6.3. Check file access rights for security + +Configfile should be readable by webserver but not writeable. + + chmod 640 config.inc + chgrp www-data config.inc 7. Start using YMS @@ -123,6 +122,7 @@ Start your browser and login to YMS with the initial username/password: captain/captain Use local client: -Start ymsgui.py -Change the password using the local GUI before normal use. +Start "yms", the default configuration file is automatically created +Change the password for the main web user using the local GUI before +normal use. diff --git a/README b/README index 2591208..9d2b6a1 100644 --- a/README +++ b/README @@ -11,3 +11,6 @@ To set your own passwords via console there is a helper script ymspass.py Use it to get an SQL-statement for changing passwords. + +For further information go to https://computerclub.hoogi.de/yms +(currently german only) diff --git a/install.sh b/install.sh index 1d724b2..7f67c76 100755 --- a/install.sh +++ b/install.sh @@ -11,6 +11,24 @@ LOCALEDIR="${PREFIX}/share/locale" SOURCEDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +if [ "$1" = "uninstall" ]; then + echo "Uninstalling YMS..." + + rm -rf "${LIBDIR}" + rm -rf "${SHAREDIR}" + rm -f "${BINDIR}/yms" + rm -f "${DESKTOPDIR}/yms.desktop" + rm -rf "${DOCDIR}" + rm -f "${LOCALEDIR}/de/LC_MESSAGES/ymsgui.mo" + + rm -f "${ICONDIR}/scalable/apps/yms.svg" + rm -f "${ICONDIR}/48x48/apps/yms.png" + rm -f "${ICONDIR}/64x64/apps/yms.png" + + echo "YMS has been uninstalled successfully." + exit 0 +fi + echo "Installing YMS..." echo "Source: ${SOURCEDIR}" echo "Prefix: ${PREFIX}" @@ -43,7 +61,7 @@ install -m 0644 \ "${SOURCEDIR}/yms/ui/main.ui" \ "${SHAREDIR}/ui/main.ui" cp -a \ - "${SOURCEDIR}/webgui/shapes/." \ + "${SOURCEDIR}/shapes/." \ "${SHAREDIR}/shapes/" # Documentation @@ -72,7 +90,7 @@ install -d "${ICONDIR}/48x48/apps" install -d "${ICONDIR}/64x64/apps" install -m 0644 \ "${SOURCEDIR}/icons/yms.svg" \ - "${ICONDIR}/yms.svg" + "${ICONDIR}/scalable/apps/yms.svg" install -m 0644 \ "${SOURCEDIR}/icons/yms48.png" \ "${ICONDIR}/48x48/apps/yms.png" diff --git a/webgui/shapes/bavaria34.svg b/shapes/bavaria34.svg similarity index 100% rename from webgui/shapes/bavaria34.svg rename to shapes/bavaria34.svg diff --git a/webgui/shapes/colinarcher40.svg b/shapes/colinarcher40.svg similarity index 100% rename from webgui/shapes/colinarcher40.svg rename to shapes/colinarcher40.svg diff --git a/webgui/shapes/elizabethan29.svg b/shapes/elizabethan29.svg similarity index 100% rename from webgui/shapes/elizabethan29.svg rename to shapes/elizabethan29.svg diff --git a/webgui/shapes/etap23.svg b/shapes/etap23.svg similarity index 100% rename from webgui/shapes/etap23.svg rename to shapes/etap23.svg diff --git a/webgui/shapes/generic.svg b/shapes/generic.svg similarity index 100% rename from webgui/shapes/generic.svg rename to shapes/generic.svg diff --git a/webgui/shapes/gulfstar41.svg b/shapes/gulfstar41.svg similarity index 100% rename from webgui/shapes/gulfstar41.svg rename to shapes/gulfstar41.svg diff --git a/webgui/shapes/sigma36.svg b/shapes/sigma36.svg similarity index 100% rename from webgui/shapes/sigma36.svg rename to shapes/sigma36.svg diff --git a/webgui/shapes/varianta65.svg b/shapes/varianta65.svg similarity index 100% rename from webgui/shapes/varianta65.svg rename to shapes/varianta65.svg diff --git a/webgui/config.inc-sample b/webgui/config.inc-sample index 3d19717..6372193 100644 --- a/webgui/config.inc-sample +++ b/webgui/config.inc-sample @@ -32,7 +32,7 @@ $g_timezone = 'Europe/Berlin'; $g_locale = 'de_DE.UTF-8'; // vessel base shapes directory -$g_shapedir = 'shapes'; +$g_shapedir = '/usr/local/share/yms/shapes'; // documents and images $g_doc_basepath = '/var/local/yms'; diff --git a/yms.desktop b/yms.desktop index b1bba6e..9322dd6 100644 --- a/yms.desktop +++ b/yms.desktop @@ -1,11 +1,15 @@ [Desktop Entry] Version=1.0 Name=YMS +GenericName=Yacht Management +GenericName[de]=Yacht-Verwaltungssoftware Comment=Yacht Management Software +Comment[de]=Verwaltung von Yachten, Dokumenten und technischen Daten Exec=/usr/local/bin/yms Icon=yms StartupNotify=true Terminal=false Type=Application Categories=Office; -Keywords=Database;Documentation +Keywords=Yacht;Boat;Management;Documentation;Database; +Keywords[de]=Yacht;Boot;verwaltung;Dokumentation;Datenbank; diff --git a/ymsgui.py b/ymsgui.py index b77bfd6..a683a2d 100755 --- a/ymsgui.py +++ b/ymsgui.py @@ -39,26 +39,22 @@ cfg = { 'db': 'yms', 'user': 'yms', 'docpath': '/var/local/yms', - 'shapedir': 'webgui/shapes' + 'shapedir': '/usr/local/bin/yms/shapes' } -def get_share_dir(): - program_dir = os.path.dirname(os.path.abspath(__file__)) - source_ui = os.path.join(program_dir, "yms", "ui", "main.ui") - if os.path.isfile(source_ui): - return program_dir - return os.path.join( - os.path.dirname(os.path.dirname(program_dir)), - "share", - "yms" - ) +def get_uiprefix(): + path = os.path.realpath(__file__) + if path.startswith("/usr/local/"): + return "/usr/local/share" + if path.startswith("/usr/"): + return "/usr/share" + return "" class Frontend(): def __init__(self): - self.uipath = os.path.join(get_share_dir(), "ui") builder = Gtk.Builder() - builder.add_from_file(os.path.join(self.uipath, "main.ui")) + builder.add_from_file(os.path.join(get_uiprefix(), "yms", "ui", "main.ui")) builder.connect_signals(self) self.window = builder.get_object("wnd_main") gtkutils.init_named_controls(self, builder) @@ -89,15 +85,18 @@ class Frontend(): combobox.load_from_dict(self.combo['vessel'], vessel, self.vid) # load shape of vessel if available - handle = Rsvg.Handle() - self._svg = handle.new_from_file(os.path.join(get_share_dir(), "shapes", "elizabethan29.svg")) - #self._svg = handle.new_from_file(os.path.join(sys.path[0], cfg['shapedir'], "elizabethan29.svg")) - #viewport = Rsvg.Rectangle() - #viewport.x = 0 - #viewport.y = 0 - #viewport.width = 320 - #viewport.height = 240 - #self._svg.render_document(ctx, viewport) + if self.vid > 0: + db.cur.execute("SELECT shapefile FROM vessel WHERE vid=%s", (self.vid, )) + filename = db.cur.fetchone()[0] + handle = Rsvg.Handle() + self._svg = handle.new_from_file(os.path.join(cfg['shapedir'], filename)) + #self._svg = handle.new_from_file(os.path.join(sys.path[0], cfg['shapedir'], "elizabethan29.svg")) + #viewport = Rsvg.Rectangle() + #viewport.x = 0 + #viewport.y = 0 + #viewport.width = 320 + #viewport.height = 240 + #self._svg.render_document(ctx, viewport) # combos roles = {'captain': 'Captain', 'helmsman': 'Helmsman', 'sailor': 'Sailor'}