Native gui programming
This commit is contained in:
@@ -31,8 +31,8 @@ the privileges for accessing and modifying it.
|
|||||||
|
|
||||||
Create database-user for application with minimum necessary rights.
|
Create database-user for application with minimum necessary rights.
|
||||||
|
|
||||||
CREATE USER 'yms'@'localhost' IDENTIFIED BY '********';
|
CREATE USER 'ymsgui'@'localhost' IDENTIFIED BY '********';
|
||||||
GRANT SELECT, INSERT, UPDATE, DELETE ON yms.* TO 'yms'@'localhost';
|
GRANT SELECT, INSERT, UPDATE, DELETE ON yms.* TO 'ymsgui'@'localhost';
|
||||||
|
|
||||||
3. Run database import
|
3. Run database import
|
||||||
|
|
||||||
|
|||||||
+122
-1
@@ -214,7 +214,8 @@
|
|||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="label" translatable="yes">label</property>
|
<property name="label" translatable="yes">Equipment
|
||||||
|
Here be dragons</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
@@ -252,6 +253,126 @@
|
|||||||
<property name="tab-fill">False</property>
|
<property name="tab-fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box_provisions">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child type="tab">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Provisions</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">3</property>
|
||||||
|
<property name="tab-fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box_maintenance">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child type="tab">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Maintenance</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">4</property>
|
||||||
|
<property name="tab-fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box_projects">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child type="tab">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Projects</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">5</property>
|
||||||
|
<property name="tab-fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box_documents">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">6</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child type="tab">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Documents</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">6</property>
|
||||||
|
<property name="tab-fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -6,9 +6,12 @@ Configuration file located at ~/.config/ymsgui.conf:
|
|||||||
[DB]
|
[DB]
|
||||||
host = localhost
|
host = localhost
|
||||||
db = yms
|
db = yms
|
||||||
user = yms
|
user = ymsgui
|
||||||
pass = topsecret
|
pass = topsecret
|
||||||
|
|
||||||
|
[Documents]
|
||||||
|
basepath = /var/local/yms
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -58,6 +61,12 @@ class Frontend():
|
|||||||
else:
|
else:
|
||||||
self.vname = "Ghost(0)"
|
self.vname = "Ghost(0)"
|
||||||
|
|
||||||
|
# get list of vessels
|
||||||
|
db.cur.execute("SELECT vid, vesselname, model FROM vessel ORDER BY vid")
|
||||||
|
for row in db.cur.fetchall():
|
||||||
|
print(row)
|
||||||
|
print(type(self.combo['vessel']))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.label['vessel'].set_text(self.vname)
|
self.label['vessel'].set_text(self.vname)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
@@ -66,7 +75,7 @@ class Frontend():
|
|||||||
def on_but_info_clicked(self, widget):
|
def on_but_info_clicked(self, widget):
|
||||||
|
|
||||||
# Userlist
|
# Userlist
|
||||||
sql = ("SELECT userid, login FROM user ORDER BY login")
|
sql = ("SELECT userid, login, displayname FROM user ORDER BY login")
|
||||||
db.cur.execute(sql)
|
db.cur.execute(sql)
|
||||||
for row in db.cur.fetchall():
|
for row in db.cur.fetchall():
|
||||||
print(row)
|
print(row)
|
||||||
@@ -95,7 +104,9 @@ def create_config(cfgfile):
|
|||||||
fh.write('host = localhost\n')
|
fh.write('host = localhost\n')
|
||||||
fh.write('db = yms\n')
|
fh.write('db = yms\n')
|
||||||
fh.write('user = yms\n')
|
fh.write('user = yms\n')
|
||||||
fh.write('pass = geheim\n')
|
fh.write('pass = geheim\n\n')
|
||||||
|
fh.write('[documents]\n')
|
||||||
|
fh.write('basepath = /var/local/yms\n')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
|||||||
Reference in New Issue
Block a user