Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soitool
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
Container Registry
Model registry
Operate
Environments
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
bachelor-paa-bittet
soitool
Commits
be7acc73
Commit
be7acc73
authored
4 years ago
by
morkolai
Browse files
Options
Downloads
Patches
Plain Diff
#96 Endret snarvei til ctrl + r og fikset resizeing
parent
70c2a83f
No related branches found
Branches containing commit
No related tags found
1 merge request
!57
#96 Telefonliste & Fiks til høyde på tabeller (rundt oppløsning)
Pipeline
#83507
failed
4 years ago
Stage: lint
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
soitool/modules/module_phonebook.py
+12
-21
12 additions, 21 deletions
soitool/modules/module_phonebook.py
with
12 additions
and
21 deletions
soitool/modules/module_phonebook.py
+
12
−
21
View file @
be7acc73
...
...
@@ -10,7 +10,7 @@ from PySide2.QtWidgets import (
QCheckBox
,
)
from
PySide2.QtCore
import
Qt
,
QSize
from
PySide2.QtGui
import
QKeySequence
,
QBrush
,
QColor
,
QIcon
from
PySide2.QtGui
import
QBrush
,
QColor
,
QIcon
from
soitool.modules.module_base
import
(
ModuleBase
,
HEADLINE_FONT
,
...
...
@@ -19,7 +19,7 @@ from soitool.modules.module_base import (
)
class
Co
mponent
sChoicePopup
(
QDialog
):
class
Co
lumn
sChoicePopup
(
QDialog
):
def
__init__
(
self
,
selected_columns
):
"""
A popup for selecting wich columns to hide/show in phonebook.
...
...
@@ -102,6 +102,7 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
# Table
self
.
table
=
self
.
__create_table
()
self
.
table
.
cellChanged
.
connect
(
lambda
:
self
.
resize
())
# Buttons
self
.
buttons
=
self
.
__creat_buttons
()
...
...
@@ -145,7 +146,7 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
table
.
setItem
(
0
,
column_index
,
header_item
)
column_index
+=
1
table
.
cellChanged
.
connect
(
lambda
:
self
.
resize
())
#
table.cellChanged.connect(lambda: self.resize())
return
table
...
...
@@ -160,7 +161,6 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
# Button for editing columns
btn_components
=
QPushButton
(
"
Kolonner
"
,
self
)
btn_components
.
clicked
.
connect
(
lambda
:
self
.
open_popup
())
btn_components
.
setShortcut
(
QKeySequence
(
Qt
.
CTRL
+
Qt
.
Key_K
))
btn_components
.
setFixedWidth
(
100
)
# Buttons for adding row
...
...
@@ -214,7 +214,7 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
self
.
resize
()
def
keyPressEvent
(
self
,
event
):
"""
Keyboard shortcuts for adding
and
removing rows.
"""
Keyboard shortcuts for adding
/
removing rows
and selecting columns
.
Parameters
----------
...
...
@@ -227,6 +227,8 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
self
.
add_row
()
elif
ctrl
and
event
.
key
()
==
Qt
.
Key_Minus
:
self
.
remove_row
()
elif
ctrl
and
event
.
key
()
==
Qt
.
Key_R
:
self
.
open_popup
()
else
:
super
().
keyPressEvent
(
event
)
...
...
@@ -287,15 +289,17 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
if
self
.
buttons
.
isVisible
():
width
=
max
(
width
,
self
.
buttons
.
minimumWidth
())
self
.
setFixedWidth
(
width
)
height
=
get_table_size
(
self
.
table
)[
1
]
+
self
.
header
.
minimumHeight
()
if
self
.
buttons
.
isVisible
():
height
+=
self
.
buttons
.
minimumHeight
()
self
.
setFixed
Size
(
QSize
(
width
,
height
)
)
self
.
setFixed
Height
(
height
)
def
open_popup
(
self
):
"""
Open dialog for editing columns.
"""
popup
=
Co
mponent
sChoicePopup
(
self
.
selected_columns
)
popup
=
Co
lumn
sChoicePopup
(
self
.
selected_columns
)
popup
.
exec_
()
self
.
selected_columns
=
popup
.
get_selected_columns
()
self
.
set_columns
()
...
...
@@ -311,7 +315,7 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
Size of the module (width, height)
"""
self
.
resize
()
return
self
.
minimumWidth
(),
self
.
minimumHeight
()
return
(
self
.
minimumWidth
(),
self
.
minimumHeight
()
)
def
get_data
(
self
):
"""
Get module content as serialized data.
...
...
@@ -361,16 +365,3 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
Picture of module.
"""
return
QIcon
(
"
soitool/media/phonetable.png
"
)
if
__name__
==
"
__main__
"
:
from
PySide2.QtWidgets
import
QApplication
app
=
QApplication
()
module
=
PhonebookModule
()
module
.
show
()
app
.
exec_
()
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