-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧modular structure, filtering enhancements, readme, requirements, fol…
…ders
- Loading branch information
1 parent
20ba581
commit d6496f5
Showing
8 changed files
with
171 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from PySide6.QtCore import * | ||
from PySide6.QtGui import * | ||
from PySide6.QtWidgets import * | ||
|
||
from modules.globals import * | ||
|
||
|
||
class FormattingEngine: | ||
def align(self, alignment): | ||
self.rs_area.setAlignment(alignment) | ||
|
||
def bullet(self): | ||
cursor = self.rs_area.textCursor() | ||
cursor.beginEditBlock() | ||
selected_text = cursor.selectedText() | ||
char_format = cursor.charFormat() | ||
cursor.removeSelectedText() | ||
cursor.insertList(QTextListFormat.ListDisc) | ||
cursor.insertText(selected_text) | ||
new_cursor = self.rs_area.textCursor() | ||
new_cursor.movePosition(QTextCursor.PreviousBlock) | ||
new_cursor.mergeCharFormat(char_format) | ||
cursor.endEditBlock() | ||
|
||
def numbered(self): | ||
cursor = self.rs_area.textCursor() | ||
cursor.beginEditBlock() | ||
selected_text = cursor.selectedText() | ||
char_format = cursor.charFormat() | ||
cursor.removeSelectedText() | ||
cursor.insertList(QTextListFormat.ListDecimal) | ||
cursor.insertText(selected_text) | ||
new_cursor = self.rs_area.textCursor() | ||
new_cursor.movePosition(QTextCursor.PreviousBlock) | ||
new_cursor.mergeCharFormat(char_format) | ||
cursor.endEditBlock() | ||
|
||
def contentBold(self): | ||
font = self.rs_area.currentFont() | ||
font.setBold(not font.bold()) | ||
self.rs_area.setCurrentFont(font) | ||
|
||
def contentItalic(self): | ||
font = self.rs_area.currentFont() | ||
font.setItalic(not font.italic()) | ||
self.rs_area.setCurrentFont(font) | ||
|
||
def contentUnderline(self): | ||
font = self.rs_area.currentFont() | ||
font.setUnderline(not font.underline()) | ||
self.rs_area.setCurrentFont(font) | ||
|
||
def contentColor(self): | ||
color = QColorDialog.getColor() | ||
self.rs_area.setTextColor(color) | ||
|
||
def contentBGColor(self): | ||
color = QColorDialog.getColor() | ||
self.rs_area.setTextBackgroundColor(color) | ||
|
||
def contentFont(self): | ||
font, ok = QFontDialog.getFont(self.rs_area.currentFont(), self) | ||
if ok: | ||
self.rs_area.setCurrentFont(font) | ||
|
||
def inc_font(self): | ||
font = self.rs_area.currentFont() | ||
font.setPointSize(font.pointSize() + 1) | ||
self.rs_area.setCurrentFont(font) | ||
|
||
def dec_font(self): | ||
font = self.rs_area.currentFont() | ||
font.setPointSize(font.pointSize() - 1) | ||
self.rs_area.setCurrentFont(font) |
Oops, something went wrong.