Пример #1
0
 def quit(self):
     try:
         self.documents_controller.closeAllDocuments()
         TemporaryDirectory.delete()
         QApplication.quit()
     except Exception as e:
         Dialogs.showError(e)
Пример #2
0
	def quit(self):
		try:
			self.documents_controller.closeAllDocuments()
			TemporaryDirectory.delete()
			QApplication.quit()
		except Exception, e:
			Dialogs.showError(e)
Пример #3
0
 def close(self):
     try:
         active_window = QApplication.activeWindow()
         if active_window is not None:
             active_window.close()
     except Exception as e:
         Dialogs.showError(e)
Пример #4
0
	def close(self):
		try:
			active_window = QApplication.activeWindow()
			if active_window is not None:
				active_window.close()
		except Exception, e:
			Dialogs.showError(e)
Пример #5
0
	def removeSnippet(self, snippet):
		if snippet in self.snippets:
			del self.snippets[snippet]
			self._updateSnippetsListView()
			self.snippetsChangedSignal.emit(self.snippets)
		else:
			Dialogs.showError("Can't remove the snippet \"%s\": the snippet doesn't exist")
Пример #6
0
	def editSnippet(self, snippet):
		if snippet in self.snippets:
			code = self.snippets[snippet]
			edit_dialog = EditSnippetView(self.parent(), self, snippet, code)
			edit_dialog.show()
		else:
			Dialogs.showError("Can't edit the snippet \"%s\": the snippet doesn't exist")
Пример #7
0
	def open(self, file_path=None):
		try:
			if file_path is None:
				file_path = File.showOpenFileDialog()
			if file_path != "":
				self.documents_controller.openDocument(file_path)
		except Exception, e:
			Dialogs.showError(e)
Пример #8
0
 def saveAs(self):
     try:
         if self.documentHasFocus():
             self.focused_document.saveAs()
         else:
             QApplication.beep()
     except Exception as e:
         Dialogs.showError(e)
Пример #9
0
	def copyPreamble(self):
		try:
			if self.documentHasFocus():
				addToClipboard(self.focused_document.model.preamble)
			else:
				QApplication.beep()
		except Exception, e:
			Dialogs.showError(e)
Пример #10
0
 def editSnippet(self, snippet):
     if snippet in self.snippets:
         code = self.snippets[snippet]
         edit_dialog = EditSnippetView(self.parent(), self, snippet, code)
         edit_dialog.show()
     else:
         Dialogs.showError(
             "Can't edit the snippet \"%s\": the snippet doesn't exist")
Пример #11
0
 def removeSnippet(self, snippet):
     if snippet in self.snippets:
         del self.snippets[snippet]
         self._updateSnippetsListView()
         self.snippetsChangedSignal.emit(self.snippets)
     else:
         Dialogs.showError(
             "Can't remove the snippet \"%s\": the snippet doesn't exist")
Пример #12
0
	def preview(self):
		try:
			if self.documentHasFocus():
				self.focused_document.preview()
			else:
				QApplication.beep()
		except Exception as e:
			Dialogs.showError(e)
Пример #13
0
	def preview(self):
		try:
			if self.documentHasFocus():
				self.focused_document.preview()
			else:
				QApplication.beep()
		except Exception, e:
			Dialogs.showError(e)
Пример #14
0
	def copyPreambleAndSource(self):
		try:
			if self.documentHasFocus():
				addToClipboard("%s\n\n%s" % (self.focused_document.model.preamble, self.focused_document.model.source))
			else:
				QApplication.beep()
		except Exception, e:
			Dialogs.showError(e)
Пример #15
0
 def copyPreamble(self):
     try:
         if self.documentHasFocus():
             addToClipboard(self.focused_document.model.preamble)
         else:
             QApplication.beep()
     except Exception as e:
         Dialogs.showError(e)
Пример #16
0
	def saveAs(self):
		try:
			if self.documentHasFocus():
				self.focused_document.saveAs()
			else:
				QApplication.beep()
		except Exception, e:
			Dialogs.showError(e)
Пример #17
0
 def open(self, file_path=None):
     try:
         if file_path is None or file_path is False:
             file_path = File.showOpenFileDialog()
         if file_path != "":
             self.documents_controller.openDocument(file_path)
     except Exception as e:
         Dialogs.showError(e)
Пример #18
0
 def _doActionOnFocusedWidget(self, action):
     try:
         widget = QApplication.focusWidget()
         if hasattr(widget, action):
             method = getattr(widget, action)
             method()
         else:
             QApplication.beep()
     except Exception as e:
         Dialogs.showError(e)
Пример #19
0
	def _doActionOnFocusedWidget(self, action):
		try:
			widget = QApplication.focusWidget()
			if hasattr(widget, action):
				method = getattr(widget, action)
				method()
			else:
				QApplication.beep()
		except Exception, e:
			Dialogs.showError(e)
Пример #20
0
	def insertSnippet(self):
		try:
			action = self.sender()
			snippet = unicode(action.data().toString())
			editor = QApplication.focusWidget()
			if isinstance(editor, EditorView):
				editor.insertSnippet(snippet)
			else:
				QApplication.beep()
		except Exception, e:
			Dialogs.showError(e)
Пример #21
0
 def insertSnippet(self):
     try:
         action = self.sender()
         snippet = action.data()
         editor = QApplication.focusWidget()
         if isinstance(editor, EditorView):
             editor.insertSnippet(snippet)
         else:
             QApplication.beep()
     except Exception as e:
         Dialogs.showError(e)
Пример #22
0
	def _okClicked(self):
		snippets = self.snippets_view.snippets
		if self.name.strip() == u"":
			Dialogs.showError("The snippet name is empty")
		elif self.code.strip() == u"":
			Dialogs.showError("The snippet code is empty")
		elif self.name in snippets:
			Dialogs.showError("A snippet with the same name already exists")
		else:
			snippets[self.name] = self.code
			self.snippets_view.snippets = snippets
			self.snippets_view.snippetsChangedSignal.emit(snippets)
			self.close()
Пример #23
0
 def _okClicked(self):
     snippets = self.snippets_view.snippets
     if self.name.strip() == u"":
         Dialogs.showError("The snippet name is empty")
     elif self.code.strip() == u"":
         Dialogs.showError("The snippet code is empty")
     elif self.name in snippets:
         Dialogs.showError("A snippet with the same name already exists")
     else:
         snippets[self.name] = self.code
         self.snippets_view.snippets = snippets
         self.snippets_view.snippetsChangedSignal.emit(snippets)
         self.close()
Пример #24
0
 def _userWantToSave(self):
     return Dialogs.closeDialog(
         "The document has been modified",
         "Do you want to save your changes in %s?" %
         self.doc_controller.model.title, self)
Пример #25
0
	def _selectFont(self):
		selected_font = Dialogs.selectFont(self.font)
		if selected_font is not None:
			self.editor_font = selected_font
			self.editorFontChangedSignal.emit(selected_font)
Пример #26
0
	def _userWantToSave(self):
		return Dialogs.closeDialog("The document has been modified", "Do you want to save your changes in %s?" % self.doc_controller.model.title, self)
Пример #27
0
	def about(self):
		try:
			self.about_controller.showAbout()
		except Exception, e:
			Dialogs.showError(e)
Пример #28
0
 def _selectFont(self):
     selected_font = Dialogs.selectFont(self.font)
     if selected_font is not None:
         self.editor_font = selected_font
         self.editorFontChangedSignal.emit(selected_font)
Пример #29
0
 def saveAll(self):
     try:
         self.documents_controller.saveAllDocuments()
     except Exception as e:
         Dialogs.showError(e)
Пример #30
0
	def new(self):
		try:
			self.documents_controller.openEmptyDocument()
		except Exception, e:
			Dialogs.showError(e)
Пример #31
0
	def showPreferences(self):

		try:
			self.preferences_controller.showPreferences()
		except Exception, e:
			Dialogs.showError(e)
Пример #32
0
 def showPreferences(self):
     try:
         self.preferences_controller.showPreferences()
     except Exception as e:
         Dialogs.showError(e)
Пример #33
0
	def saveAll(self):
		try:
			self.documents_controller.saveAllDocuments()
		except Exception, e:
			Dialogs.showError(e)
Пример #34
0
 def new(self):
     try:
         self.documents_controller.openEmptyDocument()
     except Exception as e:
         Dialogs.showError(e)
Пример #35
0
 def about(self):
     try:
         self.about_controller.showAbout()
     except Exception as e:
         Dialogs.showError(e)