Skip to content

Commit

Permalink
(upd) theme auto + shortcuts changes
Browse files Browse the repository at this point in the history
  • Loading branch information
javadr committed Mar 22, 2023
1 parent 17f8fc8 commit c8a4d86
Show file tree
Hide file tree
Showing 8 changed files with 3,007 additions and 2,944 deletions.
9 changes: 9 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
0.6.4 -- 2023-03-22
-- themes: auto, dark, light
-- Several shortcuts changed.
-- Save As --> Ctrl + Shift + S
-- Dark Theme --> Ctrl+T, Ctrl+D
-- Light Theme --> Ctrl+T, Ctrl+L
-- Interactive Clipboard --> Ctrl+B
-- side-by-side view --> Ctrl+I

0.6.3 -- 2023-03-21
-- fix issue with translataion

Expand Down
48 changes: 29 additions & 19 deletions negar_gui/Ui_mwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ def setupUi(self, MainWindow):
self.gridLayout_2.setObjectName("gridLayout_2")
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.output_editor = QtWidgets.QTextEdit(self.frame_5)
self.output_editor.setObjectName("output_editor")
self.gridLayout.addWidget(self.output_editor, 4, 0, 1, 1)
self.input_editor = QtWidgets.QTextEdit(self.frame_5)
self.input_editor.setObjectName("input_editor")
self.gridLayout.addWidget(self.input_editor, 2, 0, 1, 1)
self.input_layout = QtWidgets.QGridLayout()
self.input_layout.setObjectName("input_layout")
self.input_editor_label = QtWidgets.QLabel(self.frame_5)
self.input_editor_label.setObjectName("input_editor_label")
self.input_layout.addWidget(self.input_editor_label, 0, 0, 1, 1)
self.input_editor = QtWidgets.QTextEdit(self.frame_5)
self.input_editor.setObjectName("input_editor")
self.input_layout.addWidget(self.input_editor, 1, 0, 1, 1)
self.gridLayout.addLayout(self.input_layout, 0, 0, 1, 1)
self.output_editor_label = QtWidgets.QLabel(self.frame_5)
self.output_editor_label.setObjectName("output_editor_label")
self.gridLayout.addWidget(self.output_editor_label, 1, 0, 1, 1)
self.output_editor = QtWidgets.QTextEdit(self.frame_5)
self.output_editor.setObjectName("output_editor")
self.gridLayout.addWidget(self.output_editor, 2, 0, 1, 1)
self.gridLayout.addWidget(self.output_editor_label, 3, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.verticalLayout.addWidget(self.frame_5)
self.gridLayout_6.addWidget(self.frame_6, 0, 0, 1, 1)
Expand Down Expand Up @@ -217,6 +217,8 @@ def setupUi(self, MainWindow):
self.menuEdit.setObjectName("menuEdit")
self.menu_View = QtWidgets.QMenu(self.menubar)
self.menu_View.setObjectName("menu_View")
self.menu_Theme = QtWidgets.QMenu(self.menu_View)
self.menu_Theme.setObjectName("menu_Theme")
MainWindow.setMenuBar(self.menubar)
self.statusBar = QtWidgets.QStatusBar(MainWindow)
self.statusBar.setObjectName("statusBar")
Expand All @@ -231,7 +233,7 @@ def setupUi(self, MainWindow):
icon10 = QtGui.QIcon()
icon10.addPixmap(QtGui.QPixmap(":/images/icons/export.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionExport.setIcon(icon10)
self.actionExport.setShortcut("Ctrl+E")
self.actionExport.setShortcut("Ctrl+Shift+S")
self.actionExport.setObjectName("actionExport")
self.actionExit = QtWidgets.QAction(MainWindow)
icon11 = QtGui.QIcon()
Expand Down Expand Up @@ -383,13 +385,13 @@ def setupUi(self, MainWindow):
self.actionReset.setObjectName("actionReset")
self.actionSide_by_Side_View = QtWidgets.QAction(MainWindow)
self.actionSide_by_Side_View.setCheckable(True)
self.actionSide_by_Side_View.setShortcut("Ctrl+S")
self.actionSide_by_Side_View.setShortcut("Ctrl+I")
self.actionSide_by_Side_View.setObjectName("actionSide_by_Side_View")
self.actionAbout_Negar_GUI = QtWidgets.QAction(MainWindow)
self.actionAbout_Negar_GUI.setObjectName("actionAbout_Negar_GUI")
self.actionInteractive_Clipboard = QtWidgets.QAction(MainWindow)
self.actionInteractive_Clipboard.setCheckable(True)
self.actionInteractive_Clipboard.setShortcut("Ctrl+I")
self.actionInteractive_Clipboard.setShortcut("Ctrl+B")
self.actionInteractive_Clipboard.setObjectName("actionInteractive_Clipboard")
self.actionUpdate = QtWidgets.QAction(MainWindow)
self.actionUpdate.setObjectName("actionUpdate")
Expand All @@ -399,10 +401,12 @@ def setupUi(self, MainWindow):
self.actionFull_Screen_Input = QtWidgets.QAction(MainWindow)
self.actionFull_Screen_Input.setCheckable(True)
self.actionFull_Screen_Input.setObjectName("actionFull_Screen_Input")
self.action_Dark_Mode = QtWidgets.QAction(MainWindow)
self.action_Dark_Mode.setCheckable(True)
self.action_Dark_Mode.setEnabled(True)
self.action_Dark_Mode.setObjectName("action_Dark_Mode")
self.action_dark = QtWidgets.QAction(MainWindow)
self.action_dark.setObjectName("action_dark")
self.action_Light = QtWidgets.QAction(MainWindow)
self.action_Light.setObjectName("action_Light")
self.action_Auto = QtWidgets.QAction(MainWindow)
self.action_Auto.setObjectName("action_Auto")
self.menuFile.addAction(self.actionOpen)
self.menuFile.addAction(self.actionExport)
self.menuFile.addSeparator()
Expand Down Expand Up @@ -448,12 +452,15 @@ def setupUi(self, MainWindow):
self.menuEdit.addAction(self.actionReset)
self.menuEdit.addSeparator()
self.menuEdit.addAction(self.actionQr_Code)
self.menu_Theme.addAction(self.action_dark)
self.menu_Theme.addAction(self.action_Light)
self.menu_Theme.addAction(self.action_Auto)
self.menu_View.addAction(self.actionIncrease_Font_Size)
self.menu_View.addAction(self.actionDecrease_Font_Size)
self.menu_View.addSeparator()
self.menu_View.addAction(self.actionSide_by_Side_View)
self.menu_View.addAction(self.actionFull_Screen_Input)
self.menu_View.addAction(self.action_Dark_Mode)
self.menu_View.addAction(self.menu_Theme.menuAction())
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuEdit.menuAction())
self.menubar.addAction(self.menu_View.menuAction())
Expand All @@ -478,7 +485,6 @@ def setupUi(self, MainWindow):
self.paste_btn.clicked.connect(self.input_editor.paste) # type: ignore
self.qrcode_btn.clicked['bool'].connect(self.actionQr_Code.trigger) # type: ignore
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.input_editor, self.output_editor)
MainWindow.setTabOrder(self.output_editor, self.reset_btn)

def retranslateUi(self, MainWindow):
Expand All @@ -502,8 +508,9 @@ def retranslateUi(self, MainWindow):
self.menuHelp.setTitle(_translate("MainWindow", "&Help"))
self.menuEdit.setTitle(_translate("MainWindow", "&Edit"))
self.menu_View.setTitle(_translate("MainWindow", "&View"))
self.menu_Theme.setTitle(_translate("MainWindow", "&Theme"))
self.actionOpen.setText(_translate("MainWindow", "&Open"))
self.actionExport.setText(_translate("MainWindow", "&Export"))
self.actionExport.setText(_translate("MainWindow", "Save &As ..."))
self.actionExit.setText(_translate("MainWindow", "E&xit"))
self.actionAbout_Negar.setText(_translate("MainWindow", "&About Negar"))
self.actionDonate.setText(_translate("MainWindow", "&Donate"))
Expand Down Expand Up @@ -543,8 +550,11 @@ def retranslateUi(self, MainWindow):
self.actionQr_Code.setText(_translate("MainWindow", "&QR Code"))
self.actionFull_Screen_Input.setText(_translate("MainWindow", "&Full Screen Input"))
self.actionFull_Screen_Input.setShortcut(_translate("MainWindow", "Ctrl+F"))
self.action_Dark_Mode.setText(_translate("MainWindow", "&Dark Mode"))
self.action_Dark_Mode.setShortcut(_translate("MainWindow", "Ctrl+D"))
self.action_dark.setText(_translate("MainWindow", "&Dark"))
self.action_dark.setShortcut(_translate("MainWindow", "Ctrl+T, Ctrl+D"))
self.action_Light.setText(_translate("MainWindow", "&Light"))
self.action_Light.setShortcut(_translate("MainWindow", "Ctrl+T, Ctrl+L"))
self.action_Auto.setText(_translate("MainWindow", "&Auto"))
from . import resource_rc


Expand Down
2 changes: 1 addition & 1 deletion negar_gui/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
import platform

__version__ = "0.6.3"
__version__ = "0.6.4"

if platform.system() == 'Windows':
LOGO = ":/images/icons/logo_small.png"
Expand Down
12 changes: 6 additions & 6 deletions negar_gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,17 @@ def grid_full_input():
grid_layout('v') if self.actionSide_by_Side_View.isChecked() else grid_layout('h') )
)

self.action_Dark_Mode.triggered.connect(lambda: (
self.action_dark.triggered.connect(lambda:
qdarktheme.setup_theme("dark",
custom_colors={
"[dark]": {
"primary": "#D0BCFF",
"primary>button.hoverBackground": "#ffffff",
}
},) if self.action_Dark_Mode.isChecked()
else qdarktheme.setup_theme("light")
)
)
},) )
self.action_Light.triggered.connect(lambda: qdarktheme.setup_theme("light") )
self.action_Auto.triggered.connect(lambda: qdarktheme.setup_theme("auto") )

def qrcode(self):
if len(self.output_editor.toPlainText().strip())==0:
if self.lang == 'Persian':
Expand Down Expand Up @@ -511,7 +511,7 @@ def main():
global MainWindow
qdarktheme.enable_hi_dpi()
app = QApplication(sys.argv)
qdarktheme.setup_theme("light")
qdarktheme.setup_theme("auto")
MainWindow = MyWindow()
MainWindow.show()
sys.exit(app.exec_())
Expand Down
54 changes: 34 additions & 20 deletions negar_gui/mwin.ui
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QTextEdit" name="output_editor"/>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="input_editor"/>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="input_layout">
<item row="0" column="0">
Expand All @@ -406,12 +412,9 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTextEdit" name="input_editor"/>
</item>
</layout>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="output_editor_label">
<property name="text">
<string>Re&amp;vision:</string>
Expand All @@ -421,9 +424,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QTextEdit" name="output_editor"/>
</item>
</layout>
</item>
</layout>
Expand Down Expand Up @@ -539,12 +539,20 @@
<property name="title">
<string>&amp;View</string>
</property>
<widget class="QMenu" name="menu_Theme">
<property name="title">
<string>&amp;Theme</string>
</property>
<addaction name="action_dark"/>
<addaction name="action_Light"/>
<addaction name="action_Auto"/>
</widget>
<addaction name="actionIncrease_Font_Size"/>
<addaction name="actionDecrease_Font_Size"/>
<addaction name="separator"/>
<addaction name="actionSide_by_Side_View"/>
<addaction name="actionFull_Screen_Input"/>
<addaction name="action_Dark_Mode"/>
<addaction name="menu_Theme"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
Expand All @@ -571,10 +579,10 @@
<normaloff>:/images/icons/export.svg</normaloff>:/images/icons/export.svg</iconset>
</property>
<property name="text">
<string>&amp;Export</string>
<string>Save &amp;As ...</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+E</string>
<string notr="true">Ctrl+Shift+S</string>
</property>
</action>
<action name="actionExit">
Expand Down Expand Up @@ -950,7 +958,7 @@
<string>&amp;Side-by-Side View</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+S</string>
<string notr="true">Ctrl+I</string>
</property>
</action>
<action name="actionAbout_Negar_GUI">
Expand All @@ -966,7 +974,7 @@
<string>&amp;Interactive Clipboard</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+I</string>
<string notr="true">Ctrl+B</string>
</property>
</action>
<action name="actionUpdate">
Expand Down Expand Up @@ -994,23 +1002,29 @@
<string>Ctrl+F</string>
</property>
</action>
<action name="action_Dark_Mode">
<property name="checkable">
<bool>true</bool>
<action name="action_dark">
<property name="text">
<string>&amp;Dark</string>
</property>
<property name="enabled">
<bool>true</bool>
<property name="shortcut">
<string>Ctrl+T, Ctrl+D</string>
</property>
</action>
<action name="action_Light">
<property name="text">
<string>&amp;Dark Mode</string>
<string>&amp;Light</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
<string>Ctrl+T, Ctrl+L</string>
</property>
</action>
<action name="action_Auto">
<property name="text">
<string>&amp;Auto</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>input_editor</tabstop>
<tabstop>output_editor</tabstop>
<tabstop>reset_btn</tabstop>
</tabstops>
Expand Down
Loading

0 comments on commit c8a4d86

Please sign in to comment.