Commit [51d31f] Maximize Restore History

Move HtmlDialog and LocaleDialog to dialogs.py

Dmitry Shachnev Dmitry Shachnev 2013-07-10

changed ReText/window.py
copied ReText/htmldialog.py -> ReText/dialogs.py
ReText/window.py Diff Switch to side-by-side view
Loading...
ReText/htmldialog.py to ReText/dialogs.py
--- a/ReText/htmldialog.py
+++ b/ReText/dialogs.py
@@ -2,11 +2,13 @@
 # Copyright: Dmitry Shachnev 2012
 # License: GNU GPL v2 or higher
 
-from ReText import QtWidgets, monofont, DOCTYPE_HTML
+from ReText import QtWidgets, monofont, DOCTYPE_HTML, app_name
 from ReText.highlighter import ReTextHighlighter
 
-(QDialog, QDialogButtonBox, QTextEdit, QVBoxLayout) = (QtWidgets.QDialog,
- QtWidgets.QDialogButtonBox, QtWidgets.QTextEdit, QtWidgets.QVBoxLayout)
+(QCheckBox, QDialog, QDialogButtonBox, QLabel, QLineEdit, QTextEdit,
+ QVBoxLayout) = (QtWidgets.QCheckBox, QtWidgets.QDialog,
+ QtWidgets.QDialogButtonBox, QtWidgets.QLabel, QtWidgets.QLineEdit,
+ QtWidgets.QTextEdit, QtWidgets.QVBoxLayout)
 
 class HtmlDialog(QDialog):
 	def __init__(self, parent=None):
@@ -23,3 +25,22 @@
 		buttonBox.setStandardButtons(QDialogButtonBox.Close)
 		buttonBox.rejected.connect(self.close)
 		verticalLayout.addWidget(buttonBox)
+
+class LocaleDialog(QDialog):
+	def __init__(self, parent, defaultText=""):
+		QDialog.__init__(self, parent)
+		self.setWindowTitle(app_name)
+		verticalLayout = QVBoxLayout(self)
+		self.label = QLabel(self)
+		self.label.setText(self.tr('Enter locale name (example: en_US)'))
+		verticalLayout.addWidget(self.label)
+		self.localeEdit = QLineEdit(self)
+		self.localeEdit.setText(defaultText)
+		verticalLayout.addWidget(self.localeEdit)
+		self.checkBox = QCheckBox(self.tr('Set as default'), self)
+		verticalLayout.addWidget(self.checkBox)
+		buttonBox = QDialogButtonBox(self)
+		buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
+		verticalLayout.addWidget(buttonBox)
+		self.accepted.connect(self.accept)
+		self.rejected.connect(self.reject)