Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ converted
**/logs
tests/
**/__pycache__
**/*.ui
**/*.ts
**/*.pyproject
**/*.pyproject.user
**/*.qrc
**/*.db
.idea
.vscode
12 changes: 10 additions & 2 deletions src/PYMD/interface/_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,33 @@ def __language(self):
"""Change UI language"""
__result: int = 0
if self.ui.text_preview_mode.isVisible():
__result = self.__box_dialog(self.tr('Warning'),self.tr('Extracted content will be deleted once you change the language (unless you have already saved it)'),{'ok': self.tr('Accept')}).exec()
# Show a warning dialog before change language
__result = self.__box_dialog(self.tr('Warning'), self.tr('Extracted content will be deleted once you change the language (unless you have already saved it)'),{'ok': self.tr('Accept')}).exec()
if not self.ui.text_preview_mode.isVisible() or __result == 1024:
#Feature: Save content in a temporal file (The content is removed when language change)
lang_manager.show_dialog()
#Update UI language
self.ui.retranslateUi(self)
self.current_lang = lang_manager.lang_code
# When initial info screen is visible
if self.__init_help.info.isVisible(): self.__init_help.load_info(self.current_lang)

def __box_dialog(self, title:str = '', text:str = '', buttons_cancel_ok:dict | None = None, icon:QIcon | None = None) -> QMessageBox:
"""Create a box dialog"""
__icon: QIcon = icon if icon is not None else self.__icon_window
__dialog: QMessageBox = QMessageBox()
# Standard dialog buttons
__dialog.setStandardButtons(__dialog.StandardButton.Ok | __dialog.StandardButton.Cancel)
__buttons_txt:list[str] = ['Ok', 'Cancel']
# If not give buttons labels
__buttons_txt:list[str] = [self.tr('Ok'), self.tr('Cancel')]
__dialog.setWindowIcon(__icon)
__dialog.setWindowTitle(title)
__dialog.setText(text)
# Has been received a dict with buttons
if buttons_cancel_ok is not None and type(buttons_cancel_ok) is dict:
if 'ok' in buttons_cancel_ok: __buttons_txt[0] = buttons_cancel_ok['ok']
if 'cancel' in buttons_cancel_ok: __buttons_txt[1] = buttons_cancel_ok['cancel']
# Set visible text for each button
__dialog.button(__dialog.StandardButton.Ok).setText(__buttons_txt[0])
__dialog.button(__dialog.StandardButton.Cancel).setText(__buttons_txt[1])
return __dialog
Expand All @@ -158,6 +165,7 @@ def __theme(self):
pass

def __osl(self):
"""Load Open Source Licenses (Information - OSL)"""
OSL(self, lang_manager)

def run():
Expand Down
187 changes: 187 additions & 0 deletions src/PYMD/interface/dialog_about.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Tutos Rive</author>
<class>about_dialog</class>
<widget class="QDialog" name="about_dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>578</width>
<height>640</height>
</rect>
</property>
<property name="font">
<font>
<family>Gabriola</family>
<pointsize>20</pointsize>
</font>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<property name="locale">
<locale language="English" country="UnitedKingdom"/>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QDialogButtonBox" name="close_button">
<property name="font">
<font>
<family>Gabriola</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Close</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="container_label_about">
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="about_label">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<family>Gabriola</family>
<pointsize>10</pointsize>
<italic>false</italic>
<bold>true</bold>
<underline>false</underline>
<strikeout>false</strikeout>
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(59, 59, 59);
color: #84CD4F;
border-radius: 5px;</string>
</property>
<property name="locale">
<locale language="English" country="UnitedKingdom"/>
</property>
<property name="text">
<string>&lt;code&gt;pip install pymd&lt;/code&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::TextFormat::RichText</enum>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QScrollArea" name="container_scroll_about">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="container_about_text">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>562</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="text_about">
<property name="maximumSize">
<size>
<width>540</width>
<height>16777215</height>
</size>
</property>
<property name="locale">
<locale language="English" country="UnitedKingdom"/>
</property>
<property name="textFormat">
<enum>Qt::TextFormat::MarkdownText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextInteractionFlag::LinksAccessibleByMouse|Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>close_button</sender>
<signal>accepted()</signal>
<receiver>about_dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>close_button</sender>
<signal>rejected()</signal>
<receiver>about_dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading