Skip to content

Commit

Permalink
* Adding Aron-License
Browse files Browse the repository at this point in the history
  + Preparing GUI to migrate from Aron-License from django to Python/Qt
  + Added images / modules / QtUI
  + Setup template base
  • Loading branch information
Tony committed Aug 30, 2017
1 parent 9310c5e commit 34912c3
Show file tree
Hide file tree
Showing 9 changed files with 1,409 additions and 24 deletions.
876 changes: 876 additions & 0 deletions QtUI/dialogLic.ui

Large diffs are not rendered by default.

Binary file added QtUI/license.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 54 additions & 12 deletions QtUI/mainwindow_l.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@
<property name="geometry">
<rect>
<x>7</x>
<y>142</y>
<y>169</y>
<width>39</width>
<height>25</height>
</rect>
Expand Down Expand Up @@ -1381,7 +1381,7 @@
<property name="geometry">
<rect>
<x>7</x>
<y>116</y>
<y>143</y>
<width>39</width>
<height>25</height>
</rect>
Expand Down Expand Up @@ -1465,7 +1465,7 @@
<property name="geometry">
<rect>
<x>7</x>
<y>90</y>
<y>117</y>
<width>39</width>
<height>25</height>
</rect>
Expand Down Expand Up @@ -1614,7 +1614,7 @@
<property name="geometry">
<rect>
<x>7</x>
<y>168</y>
<y>195</y>
<width>39</width>
<height>25</height>
</rect>
Expand Down Expand Up @@ -1656,7 +1656,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>200</y>
<y>227</y>
<width>51</width>
<height>16</height>
</rect>
Expand All @@ -1669,7 +1669,7 @@
<property name="geometry">
<rect>
<x>2</x>
<y>230</y>
<y>257</y>
<width>51</width>
<height>21</height>
</rect>
Expand All @@ -1685,7 +1685,7 @@
<property name="geometry">
<rect>
<x>6</x>
<y>218</y>
<y>245</y>
<width>51</width>
<height>18</height>
</rect>
Expand All @@ -1701,7 +1701,7 @@
<property name="geometry">
<rect>
<x>1</x>
<y>285</y>
<y>312</y>
<width>51</width>
<height>21</height>
</rect>
Expand All @@ -1717,7 +1717,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>341</y>
<y>368</y>
<width>51</width>
<height>21</height>
</rect>
Expand All @@ -1733,7 +1733,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>250</y>
<y>277</y>
<width>51</width>
<height>28</height>
</rect>
Expand All @@ -1749,7 +1749,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>305</y>
<y>332</y>
<width>51</width>
<height>28</height>
</rect>
Expand All @@ -1765,7 +1765,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>360</y>
<y>387</y>
<width>51</width>
<height>28</height>
</rect>
Expand All @@ -1777,6 +1777,48 @@
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="btAronLic">
<property name="geometry">
<rect>
<x>7</x>
<y>90</y>
<width>39</width>
<height>25</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string extracomment="Logout"/>
</property>
<property name="statusTip">
<string extracomment="Logout"/>
</property>
<property name="whatsThis">
<string extracomment="Logout"/>
</property>
<property name="accessibleName">
<string extracomment="Logout"/>
</property>
<property name="accessibleDescription">
<string extracomment="Logout"/>
</property>
<property name="text">
<string/>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="toolTipDuration" stdset="0">
<number>10</number>
</property>
</widget>
</widget>
<widget class="QStatusBar" name="statusBar">
<property name="palette">
Expand Down
51 changes: 51 additions & 0 deletions modules/License.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import os
from PyQt5.Qt import *
from modules.dialogLic import Ui_DialogLic
from modules import sql_query


class DialogLic(QDialog, Ui_DialogLic):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.setupUi(self)
save_img = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'save.png'))
trash_img = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'trash.png'))
generate_img = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'generate.png'))

self.btSave.setIcon(QIcon(save_img))
self.btSave.setToolTip('Salve Licenza')
self.btSave.setToolTipDuration(10000)
self.btGenerate.setIcon(QIcon(generate_img))
self.btGenerate.setToolTip('Genera Licenza')
self.btGenerate.setToolTipDuration(10000)
self.btDelete.setIcon(QIcon(trash_img))
self.btDelete.setToolTip('Cancella Licenza')
self.btDelete.setToolTipDuration(10000)

self.btSave.clicked.connect(self._save)

for i in reversed(range(self.tableWidget.rowCount())):
self.tableWidget.removeRow(i)
db_table = sql_query.Q(action='license')
for row in range(0, len(db_table)):
self.tableWidget.insertRow(self.tableWidget.rowCount())
for colum in range(0, 10):
value = QTableWidgetItem(str(db_table[row][colum]), 0)
self.tableWidget.setItem(row, colum, value)
colum += 1
row += 1

def closeEvent(self, event):
if self._want_to_close:
super(DialogLic, self).closeEvent()
else:
self.hide()

def keyPressEvent(self, event):
if event.key() == Qt.Key_Enter:
self.accept()
if event.key() == Qt.Key_Escape:
self.hide()

def _save(self):
self.hide()
17 changes: 17 additions & 0 deletions modules/aron.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from modules import Users
from modules import Logs
from modules import Database
from modules import License


__version__ = '1.0'
Expand Down Expand Up @@ -90,6 +91,7 @@ def __init__(self):
save = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'save.png'))
modify = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'modify.png'))
db = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'db.png'))
license = QPixmap(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../QtUI', 'license.png'))

# GUI
self.ui.tableWidget.setColumnWidth(3, 562)
Expand Down Expand Up @@ -191,6 +193,10 @@ def __init__(self):
self.ui.btDataBase.setIcon(QIcon(db))
self.ui.btDataBase.setToolTip('Impostazione Database')
self.ui.btDataBase.setToolTipDuration(10000)

self.ui.btAronLic.setIcon(QIcon(license))
self.ui.btAronLic.setToolTip('Licenze Aron-Proxy')
self.ui.btAronLic.setToolTipDuration(10000)

# Button events
self.ui.btClientPlus.clicked.connect(self._new_client)
Expand Down Expand Up @@ -236,6 +242,8 @@ def __init__(self):
self.ui.btSaveModify.clicked.connect(self._unfreeze_table)

self.ui.btDataBase.clicked.connect(self._database)

self.ui.btAronLic.clicked.connect(self._license)

self.ui.progressBar.setHidden(True)

Expand Down Expand Up @@ -276,6 +284,7 @@ def _ready(self):
self.ui.btLogin.setEnabled(True)
self.ui.btUsers.setHidden(True)
self.ui.btLogs.setHidden(True)
self.ui.btAronLic.setHidden(True)
self.ui.btLogin.setFocus(True)
self.ui.plainTextEdit.setDisabled(True)
self.ui.plainTextEdit.setReadOnly(True)
Expand Down Expand Up @@ -335,11 +344,13 @@ def _login(self):
self.ui.btLogs.setHidden(False)
self.ui.btMinus_foto.setDisabled(False)
self.ui.btTrash.setDisabled(False)
self.ui.btAronLic.setHidden(False)
sql_query.Q(action='log', kwargs=[self.ui.labelUserName.text(), codes.msg(code=405) + 'admin'])
else:
self.ui.btMinus_foto.setDisabled(True)
self.ui.btTrash.setDisabled(True)
self.ui.btUsers.setHidden(True)
self.ui.btAronLic.setHidden(True)
self.ui.btPDF.setHidden(True)
self.ui.btLogs.setHidden(True)
sql_query.Q(action='log', kwargs=[self.ui.labelUserName.text(), codes.msg(code=405) + self.ui.labelUserName.text()])
Expand Down Expand Up @@ -886,3 +897,9 @@ def statistic(self):
self.ui.lineEditTotalClient.setText('')
self.ui.lineEditTotalImages.setText(''),
self.ui.lineEditTotalAttachments.setText('')

def _license(self):
lic = License.DialogLic()
lic.exec_()
if int(lic.Accepted) is 1:
sql_query.Q(action='log', kwargs=[self.ui.labelUserName.text(), codes.msg(code=412)])
2 changes: 2 additions & 0 deletions modules/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def msg(code=None):
text = 'Modificato configurazione TXT: '
if code == 411:
text = 'Aggiornata/Modificata/Vista impostazion database'
if code == 412:
text = 'Aggiornata/Modificata/Vista impostazion aron license'
if code == 500:
text = 'Generato file di configurazione PDF '
return text
Loading

0 comments on commit 34912c3

Please sign in to comment.