;;; -*- Mode: Lisp -*- #|CLARITY: Common Lisp Data Alignment Repository Copyright (c) 2006 Samantha Kleinberg All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA contact: Samantha AT Bioinformatics DOT nyu DOT edu 715 Broadway, 10th floor New York, NY 10003|# (in-package "CLARITY") ;;Change these three variables to the appropriate values for your setup. (defvar *clarity-db-name* "clarity") (defvar *clarity-db-user* "CLDB") (defvar *clarity-db-password* "clear") (capi:define-interface clarity-database-setup-interface () () (:panes (notice-pane capi:display-pane :text '(;"" " Please make sure that you can connect to a CLARITY database." "") :background :white :visible-max-width nil) (clarity-db-title-pane capi:title-pane :text "CLARITY Database Connection" :font (gp:make-font-description :family "Helvetica" :size 10 ;; :weight :bold ;; :slant :italic ) :background :gray30 :foreground :white :visible-max-width nil ) (clarity-db-name-pane capi:text-input-pane :reader clarity-db-name-pane :text *clarity-db-name* :visible-max-width 150) (clarity-db-user-pane capi:text-input-pane :reader clarity-db-user-pane :text *clarity-db-user* ; (system:get-user-name) :visible-max-width 150) (clarity-db-password-pane capi:password-pane :reader clarity-db-password-pane :text *clarity-db-password* :visible-max-width 150) #+win32 (start-system-data-source-setup-title capi:title-pane :text "System Data Source Configuration" :font (gp:make-font-description :family "Helvetica" :size 12 ;; :weight :bold ;; :slant :italic ) :background :gray30 :foreground :white :visible-max-width nil ) #+macosx (start-system-data-source-setup-title capi:title-pane :text "System Data Source Configuration" :font (gp:make-font-description :family #+macosx "helvetica" #-macosx "Helvetica" :size 10 ;; :weight :bold ;; :slant :italic ) :background :gray30 :foreground :white :visible-max-width nil ) #+win32 (start-system-data-source-setup-button capi:push-button :text "Start Windows ODBC Driver Manager" :visible-max-width nil :callback-type :none :callback 'start-windows-data-source-setup ) #+macosx (start-system-data-source-setup-button capi:push-button :text "Start ODBC Driver Manager" :visible-max-width nil :callback-type :none :callback 'start-macosx-data-source-setup ) ) (:layouts (main-layout capi:column-layout '(notice-pane clarity-db-title-pane clarity-db-layout #| #+win32 |# start-system-data-source-setup-title #| #+win32 |# start-system-data-source-setup-button ) ) (clarity-db-layout capi:grid-layout '("Database name" clarity-db-name-pane "User" clarity-db-user-pane "Password" clarity-db-password-pane) :columns 2 :x-adjust :right ) ) (:default-initargs :default-x 300 :default-y 300 :layout 'main-layout :title "CLARITY Database Connections" )) (defun start-setup-interface () (flet ((check-fields (setup-pane) (let ((clarity-db-name (capi:text-input-pane-text (clarity-db-name-pane setup-pane))) (clarity-db-user (capi:text-input-pane-text (clarity-db-user-pane setup-pane))) ) (and clarity-db-name (string/= clarity-db-name "") clarity-db-user (string/= clarity-db-user "")) )) ) (multiple-value-bind (setup-pane valid-p) (capi:popup-confirmer (make-instance 'clarity-database-setup-interface) "CLARITY Database Connection Setup" ;; :ok-check #'check-fields :title "CLARITY" ) (when valid-p (let ((clarity-db-name (capi:text-input-pane-text (clarity-db-name-pane setup-pane))) (clarity-db-user (capi:text-input-pane-text (clarity-db-user-pane setup-pane))) (clarity-db-password (capi:text-input-pane-text (clarity-db-password-pane setup-pane))) ) (concatenate 'string clarity-db-name "/" clarity-db-user "/" clarity-db-password) )) )) ;(capi:display (make-instance 'clarity-database-setup-interface) ) #+win32 (defun start-windows-data-source-setup () (handler-case (system:call-system "C:\\WINDOWS\\system32\\odbcad32.exe") (error (e) (declare (ignore e)) (capi:display-message "Sorry, cannot start the ODBC driver manager."))) ) #+macosx (defun start-macosx-data-source-setup () (handler-case (system:call-system "/Applications/Utilities/ODBC\\ Administrator.app/Contents/MacOS/ODBC\\ Administrator") (error (e) (declare (ignore e)) (capi:display-message "Sorry, cannot start the ODBC driver manager."))) ) ;;; end of file -- clarity-database-setup-interface.lisp --