/[clarity]/gui/clarity-database-setup-interface.lisp
ViewVC logotype

Contents of /gui/clarity-database-setup-interface.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Aug 16 20:18:39 2006 UTC (7 years, 8 months ago) by skleinberg
File size: 6566 byte(s)
Initial import
1 ;;; -*- Mode: Lisp -*-
2
3 #|CLARITY: Common Lisp Data Alignment Repository
4 Copyright (c) 2006 Samantha Kleinberg
5 All rights reserved.
6
7 This library is free software; you can redistribute it and/or modify it under the terms of the GNU
8 Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
13 General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along with this library;
16 if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 contact: Samantha AT Bioinformatics DOT nyu DOT edu
19 715 Broadway, 10th floor
20 New York, NY 10003|#
21
22 (in-package "CLARITY")
23
24 ;;Change these three variables to the appropriate values for your setup.
25
26 (defvar *clarity-db-name* "clarity")
27 (defvar *clarity-db-user* "CLDB")
28 (defvar *clarity-db-password* "clear")
29
30 (capi:define-interface clarity-database-setup-interface ()
31 ()
32 (:panes
33 (notice-pane
34 capi:display-pane
35 :text '(;""
36 " Please make sure that you can connect to a CLARITY database."
37 "")
38 :background :white
39 :visible-max-width nil)
40
41 (clarity-db-title-pane
42 capi:title-pane
43 :text "CLARITY Database Connection"
44 :font (gp:make-font-description :family "Helvetica"
45 :size 10
46 ;; :weight :bold
47 ;; :slant :italic
48 )
49 :background :gray30
50 :foreground :white
51 :visible-max-width nil
52 )
53
54 (clarity-db-name-pane
55 capi:text-input-pane
56 :reader clarity-db-name-pane
57 :text *clarity-db-name*
58 :visible-max-width 150)
59
60 (clarity-db-user-pane
61 capi:text-input-pane
62 :reader clarity-db-user-pane
63 :text *clarity-db-user* ; (system:get-user-name)
64 :visible-max-width 150)
65
66 (clarity-db-password-pane
67 capi:password-pane
68 :reader clarity-db-password-pane
69 :text *clarity-db-password*
70 :visible-max-width 150)
71
72
73 #+win32
74 (start-system-data-source-setup-title
75 capi:title-pane
76 :text "System Data Source Configuration"
77 :font (gp:make-font-description :family "Helvetica"
78 :size 12
79 ;; :weight :bold
80 ;; :slant :italic
81 )
82 :background :gray30
83 :foreground :white
84 :visible-max-width nil
85 )
86
87 #+macosx
88 (start-system-data-source-setup-title
89 capi:title-pane
90 :text "System Data Source Configuration"
91 :font (gp:make-font-description :family #+macosx "helvetica" #-macosx "Helvetica"
92 :size 10
93 ;; :weight :bold
94 ;; :slant :italic
95 )
96 :background :gray30
97 :foreground :white
98 :visible-max-width nil
99 )
100
101 #+win32
102 (start-system-data-source-setup-button
103 capi:push-button
104 :text "Start Windows ODBC Driver Manager"
105 :visible-max-width nil
106 :callback-type :none
107 :callback 'start-windows-data-source-setup
108 )
109
110 #+macosx
111 (start-system-data-source-setup-button
112 capi:push-button
113 :text "Start ODBC Driver Manager"
114 :visible-max-width nil
115 :callback-type :none
116 :callback 'start-macosx-data-source-setup
117 )
118 )
119
120
121 (:layouts
122 (main-layout
123 capi:column-layout
124 '(notice-pane
125
126 clarity-db-title-pane
127 clarity-db-layout
128
129 #| #+win32 |# start-system-data-source-setup-title
130 #| #+win32 |# start-system-data-source-setup-button
131 )
132 )
133
134 (clarity-db-layout
135 capi:grid-layout
136 '("Database name"
137 clarity-db-name-pane
138 "User"
139 clarity-db-user-pane
140 "Password"
141 clarity-db-password-pane)
142 :columns 2
143 :x-adjust :right
144 )
145
146 )
147
148
149 (:default-initargs
150 :default-x 300
151 :default-y 300
152 :layout 'main-layout
153 :title "CLARITY Database Connections"
154 ))
155
156
157
158 (defun start-setup-interface ()
159 (flet ((check-fields (setup-pane)
160 (let ((clarity-db-name
161 (capi:text-input-pane-text
162 (clarity-db-name-pane setup-pane)))
163 (clarity-db-user
164 (capi:text-input-pane-text
165 (clarity-db-user-pane setup-pane)))
166 )
167 (and clarity-db-name (string/= clarity-db-name "")
168 clarity-db-user (string/= clarity-db-user ""))
169 ))
170 )
171 (multiple-value-bind (setup-pane valid-p)
172 (capi:popup-confirmer (make-instance 'clarity-database-setup-interface)
173 "CLARITY Database Connection Setup"
174 ;; :ok-check #'check-fields
175 :title "CLARITY"
176 )
177 (when valid-p
178 (let ((clarity-db-name
179 (capi:text-input-pane-text
180 (clarity-db-name-pane setup-pane)))
181 (clarity-db-user
182 (capi:text-input-pane-text
183 (clarity-db-user-pane setup-pane)))
184 (clarity-db-password
185 (capi:text-input-pane-text
186 (clarity-db-password-pane setup-pane)))
187 )
188 (concatenate 'string clarity-db-name "/" clarity-db-user "/" clarity-db-password)
189 ))
190 ))
191 ;(capi:display (make-instance 'clarity-database-setup-interface)
192 )
193 #+win32
194 (defun start-windows-data-source-setup ()
195 (handler-case
196 (system:call-system "C:\\WINDOWS\\system32\\odbcad32.exe")
197 (error (e)
198 (declare (ignore e))
199 (capi:display-message "Sorry, cannot start the ODBC driver manager.")))
200 )
201
202
203 #+macosx
204 (defun start-macosx-data-source-setup ()
205 (handler-case
206 (system:call-system "/Applications/Utilities/ODBC\\ Administrator.app/Contents/MacOS/ODBC\\ Administrator")
207 (error (e)
208 (declare (ignore e))
209 (capi:display-message "Sorry, cannot start the ODBC driver manager.")))
210 )
211
212 ;;; end of file -- clarity-database-setup-interface.lisp --

  ViewVC Help
Powered by ViewVC 1.1.5