Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PHILIPPE-iihm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lucas Philippe
PHILIPPE-iihm
Commits
ffa7f4ce
Commit
ffa7f4ce
authored
1 year ago
by
Lucas Philippe
Browse files
Options
Downloads
Patches
Plain Diff
Affichage du clavier
parent
1a06d9b4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
TP4/src/Main.py
+1
-1
1 addition, 1 deletion
TP4/src/Main.py
TP4/src/widgets/KeyboardWidget.py
+26
-2
26 additions, 2 deletions
TP4/src/widgets/KeyboardWidget.py
with
27 additions
and
3 deletions
TP4/src/Main.py
+
1
−
1
View file @
ffa7f4ce
...
...
@@ -5,7 +5,7 @@ from src.widgets.EditeurWindow import EditeurWindow
def
main
():
app
=
QApplication
(
sys
.
argv
)
window
=
EditeurWindow
()
window
.
resize
(
1024
,
8
00
)
#
window.resize(
575
,
2
00)
window
.
show
()
sys
.
exit
(
app
.
exec_
())
...
...
This diff is collapsed.
Click to expand it.
TP4/src/widgets/KeyboardWidget.py
+
26
−
2
View file @
ffa7f4ce
import
json
from
PyQt5.QtCore
import
Qt
,
QSize
from
PyQt5.QtGui
import
QPainter
from
PyQt5.QtWidgets
import
QWidget
from
documents.FileDefinition
import
LAYOUT_FILE
from
src.model.Key
import
Key
...
...
@@ -13,6 +15,9 @@ class KeyboardWidget(QWidget):
self
.
keyHeight
=
None
self
.
keySpacing
=
None
self
.
keyboardWidth
=
0
self
.
keyboardHeight
=
0
# Initialiser le clavier
self
.
loadLayoutJson
()
self
.
update
()
...
...
@@ -33,6 +38,25 @@ class KeyboardWidget(QWidget):
self
.
keys
.
append
(
self
.
createKey
(
keyData
))
def
createKey
(
self
,
keyData
):
return
Key
(
keyData
[
'
x
'
],
keyData
[
'
y
'
],
self
.
keyWidth
,
self
.
keyHeight
,
self
.
keySpacing
,
keyData
[
'
width
'
],
keyData
[
'
symbol
'
])
key
=
Key
(
keyData
[
'
x
'
],
keyData
[
'
y
'
],
self
.
keyWidth
,
self
.
keyHeight
,
self
.
keySpacing
,
keyData
[
'
width
'
],
keyData
[
'
symbol
'
])
bottomRightPoint
=
key
.
rect
.
bottomRight
()
currentHeight
=
bottomRightPoint
.
y
()
+
self
.
keySpacing
currentWidth
=
bottomRightPoint
.
x
()
+
self
.
keySpacing
if
self
.
keyboardHeight
<
currentHeight
:
self
.
keyboardHeight
=
currentHeight
if
self
.
keyboardHeight
<
currentWidth
:
self
.
keyboardWidth
=
currentWidth
return
key
def
paintEvent
(
self
,
event
):
self
.
sizeHint
()
painter
=
QPainter
(
self
)
for
key
in
self
.
keys
:
painter
.
drawRect
(
key
.
rect
)
painter
.
drawText
(
key
.
rect
,
Qt
.
AlignCenter
,
key
.
symbol
)
def
sizeHint
(
self
):
return
QSize
(
self
.
keyboardWidth
,
self
.
keyboardHeight
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment