Skip to content

Commit

Permalink
minor changes: script editor dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
SAMAD101 committed Mar 5, 2024
1 parent dae0ce1 commit e070fda
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 44 deletions.
82 changes: 39 additions & 43 deletions src/vorta/assets/UI/scriptedit.ui
Original file line number Diff line number Diff line change
Expand Up @@ -20,75 +20,71 @@
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Pre/Post-Backup Script:</string>
</property>
</spacer>
</widget>
</item>
<item row="4" column="1">
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Custom Pre/Post backup script:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="saveScriptButton">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item row="2" column="0">
<widget class="QTextEdit" name="scriptEdit">
<property name="font">
<font>
<family>Monospace</family>
</font>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<property name="cursor" stdset="0">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
</spacer>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
Expand Down
10 changes: 9 additions & 1 deletion src/vorta/views/script_edit_dialog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from PyQt6 import QtCore, uic
from PyQt6.QtWidgets import QDialogButtonBox

from vorta.utils import get_asset

Expand All @@ -15,11 +16,18 @@ def __init__(self, context: str, profile, parent=None) -> None:
self.context = context
if context == "pre":
self.setWindowTitle(self.tr("Edit Pre-Backup Script"))
self.label.setText(self.tr("Pre-Backup Script:"))
elif context == "post":
self.setWindowTitle(self.tr("Edit Post-Backup Script"))
self.label.setText(self.tr("Post-Backup Script:"))

self.buttonBox.button(QDialogButtonBox.StandardButton.Save).setText(self.tr("Save"))
self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setText(self.tr("Cancel"))

self.profile = profile
self.saveScriptButton.clicked.connect(self.save_script)

self.buttonBox.button(QDialogButtonBox.StandardButton.Save).clicked.connect(self.save_script)
self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).clicked.connect(self.close)

# Populate data from profile
self.populate_from_profile()
Expand Down

0 comments on commit e070fda

Please sign in to comment.