This repository has been archived by the owner on May 28, 2022. It is now read-only.
ConfigTool: General Widget update #610
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -120,10 +120,9 @@ def __init__(self, profile, config): | |
# general tab connections | ||
# | ||
self.connect(self.generalWidget.languageComboBox, QtCore.SIGNAL('currentIndexChanged(int)'), self.set_default_language) | ||
self.connect(self.avWidget.fileDirPushButton, QtCore.SIGNAL('clicked()'), self.browse_video_directory) | ||
self.connect(self.avWidget.fileDirLineEdit, QtCore.SIGNAL('editingFinished()'), self.update_record_directory) | ||
self.connect(self.generalWidget.autoHideCheckBox, QtCore.SIGNAL('toggled(bool)'), self.toggle_autohide) | ||
|
||
self.connect(self.generalWidget.translateButton, QtCore.SIGNAL('clicked()'), self.open_translate_url) | ||
self.connect(self.generalWidget.resetButton, QtCore.SIGNAL('clicked()'), self.confirm_reset) | ||
# | ||
# AV tab connections | ||
# | ||
|
@@ -134,6 +133,8 @@ def __init__(self, profile, config): | |
self.connect(self.avWidget.videoMixerComboBox, QtCore.SIGNAL('activated(const QString&)'), self.change_videomixer) | ||
self.connect(self.avWidget.videoMixerSetupPushButton, QtCore.SIGNAL('clicked()'), self.setup_video_mixer) | ||
self.connect(self.avWidget.fileGroupBox, QtCore.SIGNAL('toggled(bool)'), self.toggle_record_to_file) | ||
self.connect(self.avWidget.fileDirPushButton, QtCore.SIGNAL('clicked()'), self.browse_video_directory) | ||
self.connect(self.avWidget.fileDirLineEdit, QtCore.SIGNAL('editingFinished()'), self.update_record_directory) | ||
self.connect(self.avWidget.fileComboBox, QtCore.SIGNAL('activated(const QString&)'), self.change_file_format) | ||
self.connect(self.avWidget.fileSetupPushButton, QtCore.SIGNAL('clicked()'), self.setup_file_format) | ||
self.connect(self.avWidget.streamGroupBox, QtCore.SIGNAL('toggled(bool)'), self.toggle_record_to_stream) | ||
|
@@ -168,6 +169,15 @@ def __init__(self, profile, config): | |
def retranslate(self): | ||
self.setWindowTitle(self.app.translate("ConfigToolApp", "Freeseer ConfigTool")) | ||
|
||
# | ||
# Reusable Strings | ||
# | ||
self.confirmResetDefaultsTitleString = self.app.translate("ConfigToolApp", "Freeseer") | ||
self.confirmResetDefaultsQuestionString = self.app.translate( | ||
"ConfigToolApp", | ||
"Your Freeseer settings will be restored to their original defaults.") | ||
# --- End Reusable Strings | ||
|
||
# | ||
# Menu | ||
# | ||
|
@@ -196,9 +206,12 @@ def retranslate(self): | |
# | ||
# GeneralWidget | ||
# | ||
self.generalWidget.miscGroupBox.setTitle(self.app.translate("ConfigToolApp", "Miscellaneous")) | ||
self.generalWidget.languageLabel.setText(self.app.translate("ConfigToolApp", "Default Language")) | ||
self.generalWidget.autoHideCheckBox.setText(self.app.translate("ConfigToolApp", "Enable Auto-Hide")) | ||
self.generalWidget.languageGroupBox.setTitle(self.app.translate("ConfigToolApp", "Language")) | ||
self.generalWidget.translateButton.setText(self.app.translate("ConfigToolApp", "Help us translate")) | ||
self.generalWidget.appearanceGroupBox.setTitle(self.app.translate("ConfigToolApp", "Appearance")) | ||
self.generalWidget.autoHideCheckBox.setText(self.app.translate("ConfigToolApp", "Auto-Hide to system tray on record")) | ||
self.generalWidget.resetGroupBox.setTitle(self.app.translate("ConfigToolApp", "Reset")) | ||
self.generalWidget.resetButton.setText(self.app.translate("ConfigToolApp", "Reset settings to defaults")) | ||
# --- End GeneralWidget | ||
|
||
# | ||
|
@@ -289,20 +302,24 @@ def set_default_language(self, language): | |
self.config.default_language = language_file | ||
self.config.save() | ||
|
||
def browse_video_directory(self): | ||
directory = self.avWidget.fileDirLineEdit.text() | ||
def open_translate_url(self): | ||
url = QtCore.QUrl("http://freeseer.readthedocs.org/en/latest/contribute/translation.html") | ||
QtGui.QDesktopServices.openUrl(url) | ||
|
||
newDir = QtGui.QFileDialog.getExistingDirectory(self, "Select Video Directory", directory) | ||
if newDir == "": | ||
newDir = directory | ||
|
||
videodir = os.path.abspath(str(newDir)) | ||
self.avWidget.fileDirLineEdit.setText(videodir) | ||
self.avWidget.fileDirLineEdit.emit(QtCore.SIGNAL("editingFinished()")) | ||
|
||
def update_record_directory(self): | ||
self.config.videodir = str(self.avWidget.fileDirLineEdit.text()) | ||
self.config.save() | ||
def confirm_reset(self): | ||
"""Presents a confirmation dialog to ask the user if they are sure they wish to reset all settings. | ||
If confirmed, reset the settings in this profile to default | ||
""" | ||
confirm = QMessageBox.question(self, | ||
self.confirmResetDefaultsTitleString, | ||
self.confirmResetDefaultsQuestionString, | ||
QMessageBox.Ok | QMessageBox.Cancel, | ||
QMessageBox.Cancel) | ||
|
||
if confirm == QMessageBox.Ok: | ||
self.config.set_defaults() | ||
self.config.save() | ||
self.load_general_widget() | ||
|
||
def toggle_autohide(self, state): | ||
self.config.auto_hide = state | ||
|
@@ -431,6 +448,21 @@ def toggle_record_to_file(self, state): | |
self.config.record_to_file = state | ||
self.config.save() | ||
|
||
def browse_video_directory(self): | ||
directory = self.avWidget.fileDirLineEdit.text() | ||
|
||
new_dir = QtGui.QFileDialog.getExistingDirectory(self, "Select Video Directory", directory) | ||
if not new_dir: | ||
new_dir = directory | ||
|
||
videodir = os.path.abspath(str(new_dir)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mtomwing should this videodir variable be renamed to video_dir? The reason I'm unsure is that it sort of mirrors the videodir variable in the config profile class referenced below with "self.config.videodir". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
self.avWidget.fileDirLineEdit.setText(videodir) | ||
self.avWidget.fileDirLineEdit.emit(QtCore.SIGNAL("editingFinished()")) | ||
|
||
def update_record_directory(self): | ||
self.config.videodir = str(self.avWidget.fileDirLineEdit.text()) | ||
self.config.save() | ||
|
||
def change_file_format(self, format): | ||
self.config.record_to_file_plugin = format | ||
self.config.save() | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I don't like the existing style for "section headers", but since they're there this one should be consistent with them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtomwing do you mean you don't like the styling that #574 introduced? If so, what about it specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dideler I think he meant the
Section header
where my code was
Heading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right. The style code was right above the commented line, so that confused me.