Show the located rar exe
This commit is contained in:
parent
5d7e348a0e
commit
710760dc91
@ -45,7 +45,7 @@ windowsRarHelp = """
|
||||
you will need to have the tools from
|
||||
<span style=" text-decoration: underline; color:#0000ff;">
|
||||
<a href="http://www.win-rar.com/download.html">WINRar</a></span>
|
||||
installed. (ComicTagger only uses the command-line rar tool.)
|
||||
installed. (ComicTagger only uses the command-line rar tool.)<br/>A restart is needed for a new path to take effect.
|
||||
</p></body></html>
|
||||
"""
|
||||
|
||||
@ -55,7 +55,7 @@ linuxRarHelp = """
|
||||
Your package manager should have rar (e.g. "apt-get install rar"). If not, download it
|
||||
<span style=" text-decoration: underline; color:#0000ff;">
|
||||
<a href="https://www.rarlab.com/download.htm">here</a></span>,
|
||||
and install in your path. </p></body></html>
|
||||
and install in your path.<br/>A restart is needed for a new path to take effect.</p></body></html>
|
||||
"""
|
||||
|
||||
macRarHelp = """
|
||||
@ -63,7 +63,7 @@ macRarHelp = """
|
||||
you will need the rar tool. The easiest way to get this is
|
||||
to install <span style=" text-decoration: underline; color:#0000ff;">
|
||||
<a href="https://brew.sh/">homebrew</a></span>.
|
||||
</p>Once homebrew is installed, run: <b>brew install rar</b></body></html>
|
||||
</p>Once homebrew is installed, run: <b>brew install rar</b><br/>A restart is needed for a new path to take effect.</body></html>
|
||||
"""
|
||||
|
||||
|
||||
@ -203,6 +203,7 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.dir_test()
|
||||
self.leFilenameParserTest.setText(self.lblRenameTest.text())
|
||||
self.filename_parser_test()
|
||||
self.update_rar_path()
|
||||
|
||||
# Set General as start tab
|
||||
self.tabWidget.setCurrentIndex(0)
|
||||
@ -217,6 +218,8 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.leDirectory.textEdited.connect(self.dir_test)
|
||||
self.cbFilenameParser.currentIndexChanged.connect(self.switch_parser)
|
||||
|
||||
self.leRarExePath.textEdited.connect(self.update_rar_path)
|
||||
|
||||
self.btnAddLiteralReplacement.clicked.connect(self.addLiteralReplacement)
|
||||
self.btnAddValueReplacement.clicked.connect(self.addValueReplacement)
|
||||
self.btnRemoveLiteralReplacement.clicked.connect(self.removeLiteralReplacement)
|
||||
@ -378,6 +381,16 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
self.rename_error = e
|
||||
self.lblRenameTest.setText(str(e))
|
||||
|
||||
def update_rar_path(self, *args: Any, **kwargs: Any) -> None:
|
||||
rar_path: Any = pathlib.Path(self.leRarExePath.text())
|
||||
found_rar = "RAR not found"
|
||||
if rar_path and rar_path.is_absolute() and rar_path.is_file():
|
||||
found_rar = str(rar_path)
|
||||
elif utils.which("rar"):
|
||||
found_rar = str(utils.which("rar"))
|
||||
|
||||
self.lblRarFound.setText(f"RAR path: {found_rar}")
|
||||
|
||||
def switch_parser(self) -> None:
|
||||
currentParser = utils.Parser(self.cbFilenameParser.currentText())
|
||||
|
||||
@ -597,6 +610,7 @@ class SettingsWindow(QtWidgets.QDialog):
|
||||
|
||||
def select_rar(self) -> None:
|
||||
self.select_file(self.leRarExePath, "RAR")
|
||||
self.update_rar_path()
|
||||
|
||||
def clear_cache(self) -> None:
|
||||
shutil.rmtree(self.config[0].Runtime_Options__config.user_cache_dir, ignore_errors=True)
|
||||
|
@ -28,7 +28,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tGeneral">
|
||||
<attribute name="title">
|
||||
@ -1158,6 +1158,31 @@ Example Replace:
|
||||
<item>
|
||||
<widget class="QGroupBox" name="grpBoxRar">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="lblRarHelp">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
@ -1186,19 +1211,6 @@ Example Replace:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leRarExePath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="btnBrowseRar">
|
||||
<property name="sizePolicy">
|
||||
@ -1212,31 +1224,20 @@ Example Replace:
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="lblRarHelp">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leRarExePath">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblRarFound">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>In order to write to CBR/RAR archives, you will need to have the shareware tools from <a href="www.win-rar.com/download.html"><span style=" text-decoration: underline; color:#0000ff;">WinRAR</span></a> installed. </p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||
<string>RAR not found</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user