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
e62a4f68
Commit
e62a4f68
authored
4 years ago
by
Anders H. Rebner
Browse files
Options
Downloads
Patches
Plain Diff
Fikset error i codebook_widget
parent
6eb682a7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#78188
passed
4 years ago
Stage: lint
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
soitool/codebook_row_adder.py
+7
-7
7 additions, 7 deletions
soitool/codebook_row_adder.py
soitool/codebook_widget.py
+3
-3
3 additions, 3 deletions
soitool/codebook_widget.py
soitool/main_window.py
+1
-1
1 addition, 1 deletion
soitool/main_window.py
with
11 additions
and
11 deletions
soitool/codebook_row_adder.py
+
7
−
7
View file @
e62a4f68
...
...
@@ -10,7 +10,6 @@ from PySide2.QtWidgets import (
QWidget
,
)
from
PySide2.QtCore
import
Qt
from
soitool.database
import
Database
from
soitool.codebook_model_view
import
CodeBookTableModel
,
CodeBookTableView
...
...
@@ -29,6 +28,8 @@ class CodebookRowAdder(QWidget):
database. Therefore, this reference is needed to be able to
insert new rows, but it is also used to refresh the view when
the row is inserted.
database : soitool.database.Database
Database to use.
Raises
------
...
...
@@ -37,7 +38,7 @@ class CodebookRowAdder(QWidget):
None (default) or CodeBookTableView.
"""
def
__init__
(
self
,
codebook_view
=
None
):
def
__init__
(
self
,
database
,
codebook_view
=
None
):
super
().
__init__
()
# Raise error if argument is invalid
...
...
@@ -49,6 +50,7 @@ class CodebookRowAdder(QWidget):
+
"'
{}
'"
.
format
(
codebook_view
)
)
self
.
database
=
database
self
.
codebook_view
=
codebook_view
self
.
create_widgets
()
...
...
@@ -169,8 +171,6 @@ class CodebookRowAdder(QWidget):
if
len
(
category_input
)
>
0
:
category_input
=
category_input
[
0
].
upper
()
+
category_input
[
1
:]
db
=
Database
()
try
:
# If a view is used, remove its model temporarily
if
self
.
codebook_view
is
not
None
:
...
...
@@ -181,13 +181,13 @@ class CodebookRowAdder(QWidget):
"
INSERT INTO CodeBook(Word, Category, Type)
"
+
"
VALUES(?, ?, ?)
"
)
db
.
conn
.
execute
(
self
.
database
.
conn
.
execute
(
stmt
,
(
word_input
,
category_input
,
type_input
,)
)
# Add unique code to row and commit changes
db
.
add_code_to
(
word_input
)
db
.
conn
.
commit
()
self
.
database
.
add_code_to
(
word_input
)
self
.
database
.
conn
.
commit
()
# Give feedback and reset input
self
.
label_feedback
.
setText
(
"
Ord/Uttrykk lagt til.
"
)
...
...
This diff is collapsed.
Click to expand it.
soitool/codebook_widget.py
+
3
−
3
View file @
e62a4f68
...
...
@@ -7,12 +7,12 @@ from soitool.codebook_row_adder import CodebookRowAdder
class
CodebookWidget
(
QWidget
):
"""
Widget for viewing and editing codebook.
"""
def
__init__
(
self
):
def
__init__
(
self
,
database
):
super
().
__init__
()
# Create widgets
self
.
view
=
CodeBookTableView
()
self
.
row_adder
=
CodebookRowAdder
()
self
.
view
=
CodeBookTableView
(
database
)
self
.
row_adder
=
CodebookRowAdder
(
database
,
self
.
view
)
self
.
create_and_set_layouts
()
...
...
This diff is collapsed.
Click to expand it.
soitool/main_window.py
+
1
−
1
View file @
e62a4f68
...
...
@@ -197,7 +197,7 @@ class MainWindow(QMainWindow):
break
# Codebook-tab does not exist, create, add and select tab
else
:
tab
=
CodebookWidget
()
tab
=
CodebookWidget
(
self
.
database
)
self
.
tabs
.
addTab
(
tab
,
"
Kodebok
"
)
self
.
tabs
.
setCurrentWidget
(
tab
)
...
...
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