-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1215883
Showing
16 changed files
with
283 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Current File", | ||
"type": "python", | ||
"request": "launch", | ||
"program": "start.py", | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"python.linting.pylintEnabled": false, | ||
"python.linting.enabled": true, | ||
"python.linting.banditEnabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""This module provides the projetsysteme package.""" | ||
|
||
__version__ = "0.1.0" |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from PyQt5.QtWidgets import QMainWindow, QHBoxLayout, QWidget, QToolBar, QPushButton | ||
|
||
class AbstractWindow(QMainWindow): | ||
def __init__(self, parent=None): | ||
"""Initializer.""" | ||
super().__init__() | ||
|
||
def setupSidebarLayout(self,sidebarLayout, mainLayout): | ||
layout = QHBoxLayout() | ||
left = QWidget() | ||
left.setLayout(sidebarLayout) | ||
|
||
right = QWidget() | ||
right.setLayout(mainLayout) | ||
|
||
layout.addWidget(left) | ||
layout.addWidget(right) | ||
layout.setStretch(0, 3) | ||
layout.setStretch(1, 7) | ||
|
||
self.centralwidget = QWidget() | ||
self.setCentralWidget(self.centralwidget) | ||
self.centralwidget.setLayout(layout) | ||
|
||
|
||
# automatizing setting the ToolBar for the app | ||
def setToolBar(self, menuItems): | ||
tools = QToolBar() | ||
self.addToolBar(tools) | ||
for item in menuItems : | ||
tools.addWidget(item) | ||
|
||
|
||
class QPrimaryButton(QPushButton): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args,**kwargs) | ||
self.setStyleSheet("background-color: indigo;color:white;font-weight:bold;") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
class DNA(): | ||
chain= "" | ||
|
||
# read from fasta file | ||
def __init__(self, path: str): | ||
pass | ||
|
||
# generate DNA Sequence from length | ||
def __init__(slef, length: int): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# rpcontacts/main.py | ||
|
||
"""This module provides RP Contacts application.""" | ||
|
||
import sys | ||
|
||
from PyQt5.QtWidgets import QApplication | ||
|
||
from .views import Window | ||
|
||
def main(): | ||
"""RP Contacts main function.""" | ||
# Create the application | ||
app = QApplication(sys.argv) | ||
# Create the main window | ||
win = Window() | ||
win.show() | ||
# Run the event loop | ||
sys.exit(app.exec()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
""" | ||
Settings for PyQt Project | ||
""" | ||
|
||
|
||
window_title="Projet Système" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QBoxLayout, QVBoxLayout, QHBoxLayout, QWidget, QTabWidget, QLabel | ||
import sys | ||
|
||
|
||
class Window(QMainWindow): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
# set the title of main window | ||
self.setWindowTitle('Sidebar layout - www.luochang.ink') | ||
|
||
# set the size of window | ||
self.Width = 800 | ||
self.height = int(0.618 * self.Width) | ||
self.resize(self.Width, self.height) | ||
|
||
# add all widgets | ||
self.btn_1 = QPushButton('1', self) | ||
self.btn_2 = QPushButton('2', self) | ||
self.btn_3 = QPushButton('3', self) | ||
self.btn_4 = QPushButton('4', self) | ||
|
||
self.btn_1.clicked.connect(self.button1) | ||
self.btn_2.clicked.connect(self.button2) | ||
self.btn_3.clicked.connect(self.button3) | ||
self.btn_4.clicked.connect(self.button4) | ||
|
||
# add tabs | ||
self.tab1 = self.ui1() | ||
self.tab2 = self.ui2() | ||
self.tab3 = self.ui3() | ||
self.tab4 = self.ui4() | ||
|
||
self.initUI() | ||
|
||
def initUI(self): | ||
left_layout = QVBoxLayout() | ||
left_layout.addWidget(self.btn_1) | ||
left_layout.addWidget(self.btn_2) | ||
left_layout.addWidget(self.btn_3) | ||
left_layout.addWidget(self.btn_4) | ||
left_layout.addStretch(5) | ||
left_layout.setSpacing(20) | ||
left_widget = QWidget() | ||
left_widget.setLayout(left_layout) | ||
|
||
self.right_widget = QTabWidget() | ||
self.right_widget.tabBar().setObjectName("mainTab") | ||
|
||
self.right_widget.addTab(self.tab1, '') | ||
self.right_widget.addTab(self.tab2, '') | ||
self.right_widget.addTab(self.tab3, '') | ||
self.right_widget.addTab(self.tab4, '') | ||
|
||
self.right_widget.setCurrentIndex(0) | ||
self.right_widget.setStyleSheet('''QTabBar::tab{width: 0; \ | ||
height: 0; margin: 0; padding: 0; border: none;}''') | ||
|
||
main_layout = QHBoxLayout() | ||
main_layout.addWidget(left_widget) | ||
main_layout.addWidget(self.right_widget) | ||
main_layout.setStretch(0, 40) | ||
main_layout.setStretch(1, 200) | ||
main_widget = QWidget() | ||
main_widget.setLayout(main_layout) | ||
self.setCentralWidget(main_widget) | ||
|
||
# ----------------- | ||
# buttons | ||
|
||
def button1(self): | ||
self.right_widget.setCurrentIndex(0) | ||
|
||
def button2(self): | ||
self.right_widget.setCurrentIndex(1) | ||
|
||
def button3(self): | ||
self.right_widget.setCurrentIndex(2) | ||
|
||
def button4(self): | ||
self.right_widget.setCurrentIndex(3) | ||
|
||
# ----------------- | ||
# pages | ||
|
||
def ui1(self): | ||
main_layout = QVBoxLayout() | ||
main_layout.addWidget(QLabel('page 1')) | ||
main_layout.addStretch(5) | ||
main = QWidget() | ||
main.setLayout(main_layout) | ||
return main | ||
|
||
def ui2(self): | ||
main_layout = QVBoxLayout() | ||
main_layout.addWidget(QLabel('page 2')) | ||
main_layout.addStretch(5) | ||
main = QWidget() | ||
main.setLayout(main_layout) | ||
return main | ||
|
||
def ui3(self): | ||
main_layout = QVBoxLayout() | ||
main_layout.addWidget(QLabel('page 3')) | ||
main_layout.addStretch(5) | ||
main = QWidget() | ||
main.setLayout(main_layout) | ||
return main | ||
|
||
def ui4(self): | ||
main_layout = QVBoxLayout() | ||
main_layout.addWidget(QLabel('page 4')) | ||
main_layout.addStretch(5) | ||
main = QWidget() | ||
main.setLayout(main_layout) | ||
return main | ||
|
||
|
||
if __name__ == '__main__': | ||
app = QApplication(sys.argv) | ||
ex = Window() | ||
ex.show() | ||
sys.exit(app.exec_()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""This module provides views to manage the contacts table.""" | ||
|
||
from PyQt5.QtWidgets import ( | ||
QLabel, QPushButton, QVBoxLayout | ||
) | ||
|
||
from .settings import window_title | ||
from .components import AbstractWindow, QPrimaryButton | ||
|
||
|
||
|
||
class Window(AbstractWindow): | ||
"""Main Window.""" | ||
def __init__(self, parent=None): | ||
"""Initializer.""" | ||
super().__init__() | ||
self.setWindowTitle(window_title) | ||
|
||
self.setupUI() | ||
|
||
def setupUI(self): | ||
"""Setup the main window's GUI.""" | ||
# Create Buttons | ||
self.addButton = QPrimaryButton("Add") | ||
self.deleteButton = QPushButton("Delete") | ||
self.clearAllButton = QPushButton("clear all") | ||
|
||
self.setToolBar([ | ||
QPushButton('hello'), | ||
QPushButton('world') | ||
]) | ||
|
||
# Lay out the GUI | ||
sidebarLayout = QVBoxLayout() | ||
sidebarLayout.addWidget(self.addButton) | ||
sidebarLayout.addWidget(self.deleteButton) | ||
sidebarLayout.addWidget(self.clearAllButton) | ||
|
||
|
||
mainLayout = QVBoxLayout() | ||
label = QLabel() | ||
label.setText("Hello world") | ||
mainLayout.addWidget(label) | ||
|
||
self.setupSidebarLayout(sidebarLayout, mainLayout) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# rpcontacts_project/rpcontacts.py | ||
|
||
"""This module provides RP Contacts entry point script.""" | ||
|
||
from projetsysteme.main import main | ||
|
||
if __name__ == "__main__": | ||
main() |
Empty file.