test elements.

This commit is contained in:
Manu 2018-10-25 20:20:25 +08:00
parent 2b4599772c
commit a967d0d455
6 changed files with 170 additions and 0 deletions

4
.gitignore vendored
View File

@ -0,0 +1,4 @@
.DS_Store
.idea/
docs/
*.autosave

12
environment.yml Normal file
View File

@ -0,0 +1,12 @@
name: lucutus
channels:
- conda-forge
- defaults
dependencies:
- python=3.6.6
- pyqt
- pip:
- appdirs

112
locutus/UI/mainwindow.ui Normal file
View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>20</x>
<y>470</y>
<width>114</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>381</width>
<height>431</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Folders</string>
</attribute>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>30</x>
<y>10</y>
<width>351</width>
<height>251</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Settings</string>
</attribute>
</widget>
</widget>
<widget class="QProgressBar" name="progressBar">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>470</y>
<width>551</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</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="menuSomething">
<property name="title">
<string>Something</string>
</property>
<addaction name="actiontest"/>
</widget>
<widget class="QMenu" name="menuAnything">
<property name="title">
<string>Anything</string>
</property>
</widget>
<addaction name="menuSomething"/>
<addaction name="menuAnything"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actiontest">
<property name="text">
<string>test</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>

0
locutus/__init__.py Normal file
View File

42
locutus/main.py Normal file
View File

@ -0,0 +1,42 @@
import sys
import os
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog
from PyQt5.QtGui import QIcon
from PyQt5 import uic
import appdirs
appname = "Locutus"
appauthor = "BorgBase"
appdirs.user_data_dir(appname, appauthor)
appdirs.user_log_dir(appname, appauthor)
#load both ui file
uifile = os.path.join(os.path.dirname(__file__), 'UI/mainwindow.ui')
form_1, base_1 = uic.loadUiType(uifile)
class Example(base_1, form_1):
def __init__(self):
super(base_1,self).__init__()
self.setupUi(self)
self.pushButton.clicked.connect(self.change)
self.actiontest.triggered.connect(self.change)
def change(self):
self.textEdit.setText('Hello Smu!!')
self.progressBar.setValue(35)
self.openFileNameDialog()
def openFileNameDialog(self):
options = QFileDialog.Options()
options |= QFileDialog.ShowDirsOnly
options |= QFileDialog.DontUseNativeDialog
fileName = QFileDialog.getExistingDirectory(
self, "Choose Backup Directory", "", options=options)
if fileName:
print(fileName)
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())

0
setup.py Normal file
View File