Skip to content

Commit

Permalink
ajustement des TextEdit d'affichage
Browse files Browse the repository at this point in the history
  • Loading branch information
adelbke committed Mar 18, 2021
1 parent 161837b commit ef632d6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
Binary file modified projetsysteme/__pycache__/components.cpython-38.pyc
Binary file not shown.
Binary file modified projetsysteme/__pycache__/dna.cpython-38.pyc
Binary file not shown.
19 changes: 16 additions & 3 deletions projetsysteme/components.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from PyQt5 import QtCore
from PyQt5.QtWidgets import QFormLayout, QInputDialog, QLabel, QMainWindow, QHBoxLayout, QMessageBox, QTextEdit, QVBoxLayout, QWidget, QToolBar, QPushButton
from PyQt5.QtGui import QTextOption
from PyQt5.QtWidgets import QFormLayout, QInputDialog, QLabel, QMainWindow, QHBoxLayout, QMessageBox, QSizePolicy, QTextEdit, QVBoxLayout, QWidget, QToolBar, QPushButton
# from PyQt5.QtCore import Qt

from .dna import DNA
Expand Down Expand Up @@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs):
self.btn_adn_vers_arn.clicked.connect(self.action_adn_vers_arn)
self.btn_arn_vers_proteine.clicked.connect(self.action_arn_vers_proteine)
self.btn_comp_inv_adn.clicked.connect(self.action_comp_inv_adn)
self.btn_taux_gc_adn.clicked.connect(self.action_taux_gc_adn)


def action_creer_adn(self):
Expand Down Expand Up @@ -79,6 +81,11 @@ def action_arn_vers_proteine(self):
def action_comp_inv_adn(self):
DNA.get_dna_complement()
MainLayout._instance.output_dna_complement.setText(DNA.dna_complement)

def action_taux_gc_adn(self):
DNA.taux_gc()
MainLayout._instance.output_taux_gc.setText(DNA.gc_rate)



def setupButtons(self):
Expand Down Expand Up @@ -116,20 +123,26 @@ def __init__(self, *args, **kwargs):
('ADN','dna_chain'),
('ARN','rna_chain'),
('Proteine','protein_chain'),
('Comp Inv','dna_complement')
('Comp Inv','dna_complement'),
('Taux GC','taux_gc')
]
for element in elements:
label = QLabel(element[0])
textEdit = QTextEdit()
textEdit.setReadOnly(True)
textEdit.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
textEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
textEdit.setLineWrapMode(QTextEdit.NoWrap)
singleWidth = textEdit.fontMetrics().boundingRect('A').width()
textEdit.setFixedWidth(singleWidth*50)


setattr(self,'label_'+element[1], label)
setattr(self,'output_'+element[1],textEdit)
self.addRow(getattr(self,'label_'+element[1]),getattr(self,'output_'+element[1]))




class QPrimaryButton(QPushButton):
def __init__(self, *args, **kwargs):
super().__init__(*args,**kwargs)
Expand Down
3 changes: 3 additions & 0 deletions projetsysteme/dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def taux_gc(cls):
gc= int((adn.count("C")+adn.count("G")) / len(adn) * 100)
cls.gc_rate=gc

# @classmethod
# def taux_codons()


# DNA.generate_dna(15)
# DNA.translate_to_rna()
Expand Down
1 change: 1 addition & 0 deletions projetsysteme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ QTextEdit {
color: #F0F0F0;
border-radius: 4px;
border: 1px solid #32414B;
max-height: 1rem;
}

QTextEdit:hover {
Expand Down

0 comments on commit ef632d6

Please sign in to comment.