Set focus to first form field when Add button is clicked
authorStas Shtin <antisvin@gmail.com>
Wed, 7 Apr 2010 13:37:56 +0000 (17:37 +0400)
committerStas Shtin <antisvin@gmail.com>
Wed, 7 Apr 2010 13:37:56 +0000 (17:37 +0400)
src/.gitignore [new file with mode: 0644]
src/ipypbx/state.py [new file with mode: 0644]

diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644 (file)
index 0000000..eef29c1
--- /dev/null
@@ -0,0 +1,3 @@
+*~
+*.pyc
+
diff --git a/src/ipypbx/state.py b/src/ipypbx/state.py
new file mode 100644 (file)
index 0000000..4c0915f
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright (c) Stas Shtin, 2010
+
+# This file is part of IPyPBX.
+
+# IPyPBX is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# IPyPBX 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 General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with IPyPBX.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+from axiom.store import Store
+from ipypbx import models
+
+
+# Working directory path.
+PREFIX = os.path.expanduser('~/.ipypbx')
+
+# Create it if necessary.
+if not os.path.exists(PREFIX):
+    os.path.mkdir(PREFIX, mode='0700')
+
+# Initialize sqlite DB file.
+store = Store(os.path.join(PREFIX, 'ipypbx.db'))
+
+# Program state data.
+connections = list(store.query(models.Connection))
+sipProfiles = []
+domains = []
+gateways = []
+endpoints = []
+extensions = []
+