5 ;; Copyright (C) 2010 - 2013 Arnaud Gardelein
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program; if not, write to the Free Software
19 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 (define oscopy:bindir "@BINDIR@")
24 (define oscopy:pythonpath "@PYEXECDIR@")
26 (define oscopy:oscopy-cmd
27 (string-append "PATH=" oscopy:bindir ":$PATH "
28 "PYTHONPATH=" oscopy:pythonpath
29 " $COLORTERM -e 'sh ioscopy'"))
31 (define oscopy:dbus-oscopy-is-running-cmd "dbus-send --print-reply --session --dest=org.freedesktop.Oscopy /org/freedesktop/Oscopy org.freedesktop.OscopyIFace.dbus_running")
32 (define oscopy:dbus-oscopy-update-cmd "dbus-send --print-reply --session --dest=org.freedesktop.Oscopy /org/freedesktop/Oscopy org.freedesktop.OscopyIFace.dbus_update")
35 (define (oscopy:about)
36 (gschem-msg (string-append
37 "This is the oscopy major mode for gschem\n"
39 "This is highly experimental\n"
40 "You should save your work often\n"
41 "and keep backup copies. You have\n"
47 (define (oscopy:is-running)
48 (eq? (status:exit-val (system oscopy:dbus-oscopy-is-running-cmd)) 0))
50 (define (oscopy:launch-oscopy)
51 (if (oscopy:is-running)
52 (if (gschem-confirm (string-append "An instance of oscopy is already running\n"
54 (system oscopy:oscopy-cmd)
56 (system oscopy:oscopy-cmd)
60 (define (oscopy:update-oscopy)
61 (if (oscopy:is-running)
62 (system oscopy:dbus-oscopy-update-cmd)
63 (if (gschem-confirm (string-append "No running instance of oscopy\n"
65 (system oscopy:oscopy-cmd)
70 (define oscopy:oscopy-keymap
73 ("l" . oscopy:launch-oscopy)
74 ("u" . oscopy:update-oscopy)
78 (define oscopy:menu-items
79 '( ("About..." oscopy:about oscopy:about)
80 ("Launch oscopy" oscopy:launch-oscopy oscopy:launch-oscopy)
81 ("Update oscopy" oscopy:update-oscopy oscopy:update-oscopy)
85 (add-menu "oscopy" oscopy:menu-items)