mirror of
https://github.com/brmlab/edubrm.git
synced 2025-06-08 04:43:59 +02:00
work on user interface
This commit is contained in:
parent
333079d8a7
commit
68d5066b23
9 changed files with 213 additions and 59 deletions
BIN
software/back.png
Normal file
BIN
software/back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 655 B |
|
@ -1,23 +1,60 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from PyQt4.QtCore import pyqtSlot
|
||||
from PyQt4.QtGui import QIcon
|
||||
from PyQt4.QtGui import QMainWindow
|
||||
from PyQt4.QtGui import QMessageBox
|
||||
from PyQt4.QtGui import QPixmap
|
||||
from PyQt4.QtGui import QPushButton
|
||||
from mainUi import Ui_MainWindow
|
||||
|
||||
class ModuleButton(QPushButton):
|
||||
|
||||
def __init__(self, mod, parent):
|
||||
super(ModuleButton, self).__init__(QIcon("modules/%s.png" % mod.__class__.__name__), mod.title, parent)
|
||||
self.setMinimumHeight(50)
|
||||
self.mod = mod
|
||||
self.form = parent
|
||||
self.clicked.connect(self.on_clicked)
|
||||
|
||||
def on_clicked(self):
|
||||
self.form.ui.areaChoose.hide()
|
||||
self.form.ui.btnExit.hide()
|
||||
self.form.ui.btnBack.show()
|
||||
self.form.ui.lblTitle.setText(self.mod.title)
|
||||
self.mod.setup(self.form.ui.areaModule)
|
||||
|
||||
class Main(QMainWindow):
|
||||
def __init__(self):
|
||||
QMainWindow.__init__(self)
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.ui.btnBack.hide()
|
||||
self.ui.areaModule.hide()
|
||||
self.addModuleButtons()
|
||||
|
||||
@pyqtSlot()
|
||||
def on_actionExit_triggered(self):
|
||||
def on_btnExit_clicked(self):
|
||||
self.close()
|
||||
|
||||
@pyqtSlot()
|
||||
def on_actionAbout_triggered(self):
|
||||
def on_btnBack_clicked(self):
|
||||
self.ui.lblTitle.setText('EduBRM')
|
||||
# TODO: erase everything from self.ui.areaModule
|
||||
self.ui.areaChoose.show()
|
||||
self.ui.areaModule.hide()
|
||||
self.ui.btnExit.show()
|
||||
self.ui.btnBack.hide()
|
||||
|
||||
@pyqtSlot()
|
||||
def on_btnAbout_clicked(self):
|
||||
box = QMessageBox(QMessageBox.NoIcon, "About EduBRM", "EduBRM by Hackerspace brmlab\n\nhttp://brmlab.cz/\n\nSee README for more information.", QMessageBox.Ok)
|
||||
box.setIconPixmap(QPixmap( ":/icons/icon.png"))
|
||||
box.exec_()
|
||||
|
||||
def addModuleButtons(self):
|
||||
import modules
|
||||
for mod in modules.list():
|
||||
c = self.ui.gridLayout.count()
|
||||
btn = ModuleButton(mod, self)
|
||||
self.ui.gridLayout.addWidget(btn, c / 2, c % 2)
|
||||
|
|
206
software/main.ui
206
software/main.ui
|
@ -10,6 +10,18 @@
|
|||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>EduBRM</string>
|
||||
</property>
|
||||
|
@ -18,64 +30,164 @@
|
|||
<normaloff>:/icons/icon.png</normaloff>:/icons/icon.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QLabel" name="txtDesc">
|
||||
<widget class="QPushButton" name="btnExit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>501</width>
|
||||
<height>201</height>
|
||||
<width>81</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>&Exit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/exit.png</normaloff>:/icons/exit.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnAbout">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>710</x>
|
||||
<y>10</y>
|
||||
<width>81</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/about.png</normaloff>:/icons/about.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QScrollArea" name="areaChoose">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>781</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="areaChooseContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lblTitle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>10</y>
|
||||
<width>601</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>24</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<kerning>true</kerning>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>EduBRM</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnBack">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>81</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Back</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/back.png</normaloff>:/icons/back.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QScrollArea" name="areaModule">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>781</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="areaModuleContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<zorder>lblTitle</zorder>
|
||||
<zorder>areaModule</zorder>
|
||||
<zorder>btnExit</zorder>
|
||||
<zorder>btnAbout</zorder>
|
||||
<zorder>areaChoose</zorder>
|
||||
<zorder>btnBack</zorder>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Help">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<addaction name="menu_File"/>
|
||||
<addaction name="menu_Help"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionAbout">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/about.png</normaloff>:/icons/about.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&About ...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/exit.png</normaloff>:/icons/exit.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>btnAbout</tabstop>
|
||||
<tabstop>btnExit</tabstop>
|
||||
<tabstop>areaChoose</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
|
|
BIN
software/modules/ModuleA.png
Normal file
BIN
software/modules/ModuleA.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -2,7 +2,8 @@ from module import Module
|
|||
|
||||
class ModuleA(Module):
|
||||
|
||||
group = "Acko"
|
||||
title = "Acko"
|
||||
board = 1
|
||||
desc = "Toto je Acko"
|
||||
|
||||
def setup(self, area):
|
||||
print 'setup A'
|
||||
print area
|
||||
|
|
BIN
software/modules/ModuleB.png
Normal file
BIN
software/modules/ModuleB.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -2,7 +2,8 @@ from module import Module
|
|||
|
||||
class ModuleB(Module):
|
||||
|
||||
group = "Bcko"
|
||||
title = "Bcko"
|
||||
board = 1
|
||||
desc = "Toto je Bcko"
|
||||
|
||||
def setup(self, area):
|
||||
print 'setup B'
|
||||
print area
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Module():
|
||||
|
||||
group = ""
|
||||
title = ""
|
||||
board = 1
|
||||
desc = ""
|
||||
title = ''
|
||||
|
||||
def start(self, area):
|
||||
raise Exception('not implemented')
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
<RCC>
|
||||
<qresource prefix="icons">
|
||||
<file>back.png</file>
|
||||
<file>exit.png</file>
|
||||
<file>about.png</file>
|
||||
<file>icon.png</file>
|
||||
<file>modules/ModuleA.png</file>
|
||||
<file>modules/ModuleB.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue