Skip to content

Commit c96ef9f

Browse files
Develop (#22)
* adding toolbar * updates to git toolbar * updates to tool bar * finished adding toolbar * Bump Version 0.1.4 * Format code with yapf and autopep8 * Format code with yapf and autopep8 * update and bum version * Format code with yapf and autopep8 * update and bum version * many improvements * added new styles and updated theme loading functionality and fixed bugs and others * adding theme files * updated gif * Format code with yapf and autopep8 * changed github repo function to function * fixed unittest * Format code with yapf and autopep8 * made method a static method * reformated and bug fixes for menubar and actions modules * updated unit tests and fixed bugs with box combo groups * updates to ci workflow and fixed testing workflow * Format code with yapf and autopep8 * Bump version 0.1.5 * updated changelog for version 0.1.5 Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent 0b0e9f7 commit c96ef9f

File tree

12 files changed

+252
-170
lines changed

12 files changed

+252
-170
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: windows-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v2
10+
uses: actions/checkout@v3
1111
- name: Setup Python
1212
uses: actions/[email protected]
1313
- name: Display Python Version

.github/workflows/mac.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
name: MacCI
2-
3-
on: [push, pull_request]
4-
jobs:
5-
build:
6-
runs-on: macos-latest
7-
strategy:
8-
matrix:
9-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
10-
11-
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up Python
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- name: Display Python Version
18-
run: python --version
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip tox
22-
pip install -r requirements.txt
23-
24-
- name: Run Tests
25-
run: |
26-
tox
1+
name: MacCI
2+
3+
on: [push, pull_request]
4+
jobs:
5+
build:
6+
runs-on: macos-latest
7+
strategy:
8+
matrix:
9+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4.1.0
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Display Python Version
18+
run: python --version
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip tox
22+
pip install -r requirements.txt
23+
24+
- name: Run Tests
25+
run: |
26+
tox

.github/workflows/ubuntu.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: UbuntuCI
2+
3+
on: [push, pull_request]
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/[email protected]
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Display Python Version
18+
run: python --version
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip tox
22+
pip install -r requirements.txt
23+
24+
- name: Run Tests
25+
run: |
26+
tox

.github/workflows/windows.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
name: WindowsCI
2-
3-
on: [push, pull_request]
4-
jobs:
5-
build:
6-
runs-on: windows-latest
7-
strategy:
8-
matrix:
9-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
10-
11-
steps:
12-
- uses: actions/checkout@v2
13-
- name: Set up Python
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- name: Display Python Version
18-
run: python --version
19-
- name: Install dependencies
20-
run: |
21-
python -m pip install --upgrade pip tox torrentfile
22-
pip install -r requirements.txt
23-
- name: Run Tests
24-
run: |
25-
tox
1+
name: WindowsCI
2+
3+
on: [push, pull_request]
4+
jobs:
5+
build:
6+
runs-on: windows-latest
7+
strategy:
8+
matrix:
9+
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4.1.0
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Display Python Version
18+
run: python --version
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip tox torrentfile
22+
pip install -r requirements.txt
23+
- name: Run Tests
24+
run: |
25+
tox

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# QStyler CHANGELOG
22

3+
## Version 0.1.4
4+
5+
- Switched gifs in readme
6+
- Bug Fixes
7+
- Passing all unittests
8+
- Fixed linting checkers
9+
10+
* * *
11+
12+
## Version 0.1.4
13+
14+
- Improved toolbar widget
15+
- Added new icons for toolbar actions
16+
- Improved and added to Unit testing framework
17+
- Updated and expanded CI integration
18+
- Fixed issue with menubar actions
19+
- Improved coverage data and quality
20+
- Bug Fixes
21+
- Added 2 new themes
22+
23+
* * *
24+
325
## Version 0.1.3
426

527
- Added toolbar to styler menu

Manifest.in

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
include requirements.txt
2-
include Makefile
3-
include tox.ini
4-
include CHANGELOG.md
5-
6-
recursive-include .github *
7-
8-
recursive-include QStyler/icons *
9-
10-
recursive-include assets *
11-
12-
recursive-include QStyler/style *
1+
include requirements.txt
2+
include Makefile
3+
include tox.ini
4+
include CHANGELOG.md
5+
6+
recursive-include assets *
7+
recursive-include .github *
8+
9+
recursive-include QStyler/icons *
10+
recursive-include QStyler/themes *
11+
recursive-include QStyler/data *
12+
13+
recursive-exclude .tox *

QStyler/actions.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@ def __init__(self, parent=None):
5555
super().__init__(parent=parent)
5656
self.layout = QVBoxLayout()
5757
self.setLayout(self.layout)
58-
self.label = QLabel("Theme Title", self)
59-
self.setWindowTitle("Load Theme")
58+
self.resize(300, 100)
59+
self.label = QLabel("Theme Name", self)
60+
self.label2 = QLabel("File Location", self)
61+
self.setWindowTitle("Load Qss Theme")
6062
self.lineEdit = QLineEdit(self)
63+
self.lineEdit2 = QLineEdit(self)
6164
self.layout.addWidget(self.label)
6265
self.layout.addWidget(self.lineEdit)
66+
self.layout.addWidget(self.label2)
67+
self.layout.addWidget(self.lineEdit2)
6368
self.btn1 = QPushButton("Select File", self)
6469
self.btn2 = QPushButton("OK", self)
6570
self.hlayout = QHBoxLayout()
@@ -69,24 +74,25 @@ def __init__(self, parent=None):
6974
self.label.setAlignment(Qt.AlignLeft)
7075
self.btn1.clicked.connect(self.loadTheme)
7176
self.btn2.clicked.connect(self.closeDialog)
72-
self.path = None
7377

7478
def loadTheme(self):
7579
"""Load new theme into database."""
7680
result = QFileDialog.getOpenFileName(self, "Select .qss File",
7781
str(Path().home()),
7882
"QSS(*.qss), Any(*)")
79-
if result[1]:
80-
self.path = result[0]
83+
if result and result[1]:
84+
path = result[0]
85+
self.lineEdit2.setText(path)
8186
name, _ = os.path.splitext(os.path.basename(self.path))
8287
self.lineEdit.setText(name)
8388

8489
def closeDialog(self):
8590
"""Close dialog and return file path if selected."""
8691
text = self.lineEdit.text()
87-
path = self.path if self.path else ""
92+
path = self.lineEdit2.text()
8893
self.closing.emit(text, path)
8994
self.close()
95+
self.deleteLater()
9096

9197

9298
class LoadAction(QAction):
@@ -105,7 +111,7 @@ def loadTheme(self): # pragma: nocover
105111
self.dialog.closing.connect(self.getThemeFile)
106112
self.dialog.open()
107113

108-
def getThemeFile(self, title, path):
114+
def getThemeFile(self, title: str, path: str):
109115
"""Open and save data in file path as title theme."""
110116
if path and title:
111117
parser = QssParser(path)
@@ -121,11 +127,10 @@ def edit_current_sheet(self): # pragma: nocover
121127
sheet = QApplication.instance().styleSheet()
122128
self.manager = get_manager()
123129
self.dialog = QWidget()
124-
self.dialog.resize(400, 280)
125-
layout = QVBoxLayout()
126-
self.dialog.setLayout(layout)
130+
self.dialog.resize(300, 450)
131+
layout = QVBoxLayout(self.dialog)
127132
textEdit = QPlainTextEdit(self.dialog)
128-
self.dialog.setWindowTitle("StyleSheet Editor")
133+
self.dialog.setWindowTitle("Edit Current StyleSheet")
129134
layout.addWidget(textEdit)
130135
savebtn = QPushButton("Apply", parent=self.dialog)
131136
cancelbtn = QPushButton("Cancel", parent=self.dialog)
@@ -148,10 +153,9 @@ def applyStyleSheet(self): # pragma: nocover
148153
text = self.dialog.textEdit.toPlainText()
149154
converter = QssParser(text)
150155
self.manager.reset()
151-
self.manager.sheets = converter.result
156+
self.manager.sheets = converter.collection
152157
self.manager.set_sheet()
153-
self.dialog.close()
154-
self.dialog.deleteLater()
158+
self.closeDialog()
155159

156160

157161
class ShowAction(QAction):
@@ -161,17 +165,13 @@ def showStyles(self): # pragma: nocover
161165
"""Show the current stylesheet in a separate widget."""
162166
sheet = QApplication.instance().styleSheet()
163167
self.dialog = QWidget()
164-
self.dialog.resize(300, 200)
165-
layout = QVBoxLayout()
166-
self.dialog.setLayout(layout)
167-
self.dialog.setWindowTitle("Current Style Sheet")
168+
self.dialog.resize(300, 400)
169+
layout = QVBoxLayout(self.dialog)
170+
self.dialog.setWindowTitle("Current Style Sheet Theme")
168171
textEdit = QTextBrowser(parent=self.dialog)
169172
textEdit.setPlainText(sheet)
170173
layout.addWidget(textEdit)
171174
self.dialog.show()
172-
button = QPushButton("Save", self.dialog)
173-
layout.addWidget(button)
174-
button.clicked.connect(saveQss)
175175

176176

177177
def saveQss(): # pragma: nocover

QStyler/menubar.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ def __init__(self, parent) -> None:
5252
self.window = parent
5353
self.manager = get_manager()
5454
self.loadAction = LoadAction()
55-
self.loadAction.setText("Load Theme File")
55+
self.loadAction.setText("Import Theme")
5656
self.fileMenu = FileMenu("File", parent=self)
57-
self.optionsMenu = ThemeMenu("Theme", parent=self)
57+
self.optionsMenu = ThemeMenu("Themes", parent=self)
5858
self.helpMenu = HelpMenu("Help", parent=self)
5959
self.addMenu(self.fileMenu)
6060
self.addMenu(self.optionsMenu)
@@ -88,9 +88,15 @@ def __init__(self, text: str, parent=None) -> None:
8888
self.aboutqt = QAction("About Qt")
8989
self.addAction(self.aboutqt)
9090
self.aboutqt.triggered.connect(QApplication.instance().aboutQt)
91-
self.repolink = QAction("Github Repo")
91+
self.repolink = QAction("Open Github Repo")
9292
self.addAction(self.repolink)
9393
self.repolink.triggered.connect(opengithub)
94+
self.aboutQstyler = QAction("About QStyler")
95+
self.addAction(self.aboutQstyler)
96+
self.aboutQstyler.triggered.connect(self.open_about)
97+
98+
def open_about(self):
99+
"""Open the about QStyler Dialog."""
94100

95101

96102
class ThemeMenu(QMenu):
@@ -120,7 +126,7 @@ def __init__(self, text: str, parent=None) -> None:
120126
self.manager = get_manager()
121127
self.titles = self.manager.titles
122128
self.resetAction = QAction("Reset Theme")
123-
self.saveCurrent = QAction("Save Current Theme")
129+
self.saveCurrent = QAction("Save Theme As")
124130
self.resetAction.triggered.connect(self.manager.reset)
125131
toolbar = parent.window.styler.toolbar
126132
toolbar.loadAction = self.parent().loadAction
@@ -129,8 +135,8 @@ def __init__(self, text: str, parent=None) -> None:
129135
self.saveCurrent.triggered.connect(self.createTheme)
130136
self.addAction(self.parent().loadAction)
131137
self.addAction(self.saveCurrent)
132-
self.addMenu(self.themeMenu)
133138
self.addAction(self.resetAction)
139+
self.addMenu(self.themeMenu)
134140
self.themeactions = []
135141
for title in self.titles:
136142
action = QAction(title)

QStyler/styler.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def updateProp(self, row, column):
135135
prop = cbox.currentText()
136136
sheet = self.currentSheet()
137137
if prop in sheet:
138-
self.item(row, 1).setText(sheet[prop])
138+
self.item(row, 1).setText(sheet[prop]) # pragma: nocover
139139
else:
140140
self.item(row, 1).setText("")
141141

@@ -368,11 +368,13 @@ def add_widget_combo(self):
368368
def minus_widget_combo(self):
369369
"""Remove a widget combo box group."""
370370
if len(self.boxgroups) > 0:
371-
box = self.boxgroups[-1]
372-
del self.boxgroups[-1]
373-
box.deleteLater()
374-
box.destroy()
375-
self.layout.removeWidget(box)
371+
groupbox = self.boxgroups[-1]
372+
groupbox.delete_widgets()
373+
index = self.layout.indexOf(groupbox)
374+
self.layout.takeAt(index)
375+
self.boxgroups = self.boxgroups[:-1]
376+
groupbox.deleteLater()
377+
groupbox.destroy()
376378
else:
377379
self.window.statusbar.showMessage("Nothing to remove.", 4000)
378380

@@ -484,3 +486,13 @@ def __init__(self, parent=None):
484486
self.control_combo.currentIndexChanged.connect(
485487
parent.statusChanged.emit)
486488
self.combo.widgetChanged.connect(parent.statusChanged.emit)
489+
490+
def delete_widgets(self):
491+
"""Delete all widgets in the GroupBox."""
492+
for combo in [self.combo, self.control_combo, self.state_combo]:
493+
index = self.layout.indexOf(combo)
494+
item = self.layout.takeAt(index)
495+
combo.destroy()
496+
combo.deleteLater()
497+
item.widget().destroy()
498+
item.widget().deleteLater()

QStyler/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
##############################################################################
1919
"""Version File."""
2020

21-
__version__ = "0.1.4"
21+
__version__ = "0.1.5"

0 commit comments

Comments
 (0)