Skip to content

Commit d3a2fa5

Browse files
committed
updates
1 parent 0f8e1f0 commit d3a2fa5

File tree

7 files changed

+128
-41
lines changed

7 files changed

+128
-41
lines changed

main/MainWindow.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def __init__(self):
8383
self.action_Indent.triggered.connect(lambda: self.editorEvent("indent"))
8484
self.action_Unindent.triggered.connect(lambda: self.editorEvent("unindent"))
8585
self.action_Auto_Indent.triggered.connect(lambda: self.editorEvent("autoIndent"))
86+
self.action_Lower_Case.triggered.connect(lambda: self.editorEvent("caseLower"))
87+
self.action_Upper_Case.triggered.connect(lambda: self.editorEvent("caseUpper"))
88+
self.action_Title_Case.triggered.connect(lambda: self.editorEvent("caseTitle"))
8689
self.action_Move_Up.triggered.connect(lambda: self.editorEvent("moveUp"))
8790
self.action_Move_Down.triggered.connect(lambda: self.editorEvent("moveDown"))
8891
self.action_Find.triggered.connect(self.findReplace)
@@ -115,6 +118,8 @@ def __init__(self):
115118
action.setData(fr)
116119
self.menu_Transform.addAction(action)
117120
self.transformationActions.append(action)
121+
122+
self.fillGallery()
118123
self.tabChanged(self.files.currentIndex())
119124

120125
def setStatusBar(self, status: StatusBar):
@@ -357,6 +362,14 @@ def updateRecents(self, file=None):
357362
clear.setShortcuts(QtGui.QKeySequence(clr))
358363
clear.triggered.connect(lambda x: self.clearRecents())
359364

365+
def fillGallery(self):
366+
self.menuOpen_From_Gallery.clear()
367+
for p in pluginloader.get():
368+
if len(p.gallery) > 0:
369+
menu = self.menuOpen_From_Gallery.addMenu(p.name)
370+
for file in p.gallery:
371+
menu.addAction(file, lambda f=file: self.openFile(p.path("gallery", f)))
372+
360373
def warn(self, title, msg):
361374
QtWidgets.QMessageBox.warning(self, title, msg)
362375

main/editor/CodeEditor.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,28 @@ def complete(self):
717717
self.completer.setCompletionPrefix(prefix)
718718
self.completer.popup().setCurrentIndex(self.completer.completionModel().index(0, 0))
719719

720+
def _changeText(self, func=lambda x: x):
721+
cursor = self.textCursor()
722+
txt = cursor.selectedText()
723+
if txt == "":
724+
return
725+
posS = cursor.selectionStart()
726+
posE = cursor.selectionEnd()
727+
cursor.insertText(func(txt))
728+
cursor.setPosition(posS)
729+
cursor.setPosition(posE, QtGui.QTextCursor.MoveMode.KeepAnchor)
730+
self.setTextCursor(cursor)
731+
732+
def caseUpper(self):
733+
print("UPPER CASE")
734+
self._changeText(lambda txt: txt.upper())
735+
736+
def caseLower(self):
737+
self._changeText(lambda txt: txt.lower())
738+
739+
def caseTitle(self):
740+
self._changeText(lambda txt: txt.title())
741+
720742
def matchBrackets(self):
721743
paired = pluginloader.getPairedBrackets(self.wrapper.filetype.currentText())
722744
bopen = [x[0] for x in paired]

main/plugins.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def __init__(self, filename):
3434
self.enabled = True
3535
self.deps = True
3636
self.reqs = True
37+
self.gallery = []
3738
self.load()
3839

3940
def path(self, *paths):
@@ -107,6 +108,15 @@ def load(self):
107108
self.disable()
108109
self.deps = False
109110

111+
gp = os.path.join(self._dir, "gallery")
112+
if os.path.isdir(gp):
113+
exts = []
114+
for v in self.types.values():
115+
exts.extend(v["extensions"])
116+
for filename in os.listdir(gp):
117+
if filename.split(".")[-1] in exts:
118+
self.gallery.append(filename)
119+
110120
def enable(self, on=True):
111121
self.enabled = on
112122

text.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ TODO LIST [0.2.3] {Universalisation}
1111
- GraphDonkey crashes randomly
1212
- Plugin options not showing
1313
- [DONE]: Shifted to Qt6 and Python 3.13
14-
- Features:
15-
- Change case of selection (Uppercase, Lowercase, Sentence, CamelCase, PascalCase)
14+
- [DONE] Features:
15+
- Change case of selection (Uppercase, Lowercase, Title)
1616
- Load from gallery (gallery in plugin folder maybe?)
17+
- Features:
18+
- Lock files, so they cannot be overwritten + set all gallery files as locked
19+
- Watchdog to show changes live
1720
- Goto Line
1821
- Restart
1922
- Listen on host:port address instead of a file
@@ -26,7 +29,7 @@ TODO LIST [0.2.3] {Universalisation}
2629
TODO LIST [0.2.4] {Styling Update}
2730
- Styles/themes via CSS vs INI https://doc.qt.io/qt-5/stylesheet-examples.html
2831
- Style for whitespace characters? ==> Add automatically in SyntaxHighligter
29-
- fromTheme? https://www.pythonguis.com/faq/built-in-qicons-pyqt/ || https://github.com/ppinard/pyqttango
32+
- from Theme? https://www.pythonguis.com/faq/built-in-qicons-pyqt/ || https://github.com/ppinard/pyqttango
3033
- More styles: https://tmtheme-editor.herokuapp.com/#!/editor/theme/Monokai
3134
- Defaults like darcula, monokai, high contrast...
3235
- Preferences menu: https://www.jetbrains.com/help/idea/configuring-colors-and-fonts.html
File renamed without changes.

0 commit comments

Comments
 (0)