Example #1
0
    def _initToolBarActions(self, toolbar):
        actions_group = QActionGroup(self)
        show_source_action = ActionFactory.createAction(
            toolbar,
            "Source",
            "Show LaTeX source editor",
            shortcut=QKeySequence.SelectStartOfLine,
            slot=self.showSourceView,
            checkable=True)
        show_preamble_action = ActionFactory.createAction(
            toolbar,
            "Preamble",
            "Show LaTeX preamble editor",
            shortcut=QKeySequence.SelectEndOfLine,
            slot=self.showPreambleView,
            checkable=True)
        self.actions[actions.SHOW_SOURCE] = show_source_action
        self.actions[actions.SHOW_PREAMBLE] = show_preamble_action

        show_source_action.setChecked(True)
        actions_group.addAction(show_source_action)
        actions_group.addAction(show_preamble_action)

        ToolBarFactory.addItemsToToolBar(
            (self.app_controller.actions[actions.PREVIEW],
             ("Copy", self.app_controller.actions[actions.COPY_MENU]),
             ("Snippets", self.app_controller.actions[actions.SNIPPETS_MENU]),
             None, show_source_action, show_preamble_action, QLabel()),
            toolbar)
Example #2
0
 def _createCopyMenu(self, edit_menu):
     copy_menu = edit_menu.addMenu("Copy")
     ordered_actions = (self.actions[actions.COPY],
                        self.actions[actions.COPY_SOURCE],
                        self.actions[actions.COPY_PREAMBLE],
                        self.actions[actions.COPY_PREAMBLE_AND_SOURCE])
     ActionFactory.addActionsToMenu(ordered_actions, copy_menu)
     self.actions[actions.COPY_MENU] = copy_menu
Example #3
0
 def _createEditMenu(self):
     edit_menu = self.menu_bar.addMenu("Edit")
     ordered_actions = (self.actions[actions.UNDO],
                        self.actions[actions.REDO], None,
                        self.actions[actions.CUT])
     ActionFactory.addActionsToMenu(ordered_actions, edit_menu)
     self._createCopyMenu(edit_menu)
     ActionFactory.addActionsToMenu((self.actions[actions.PASTE], None),
                                    edit_menu)
     self._createSnippetsMenu(edit_menu)
Example #4
0
	def _createCopyMenu(self, edit_menu):
		copy_menu = edit_menu.addMenu("Copy")
		ordered_actions = (
			self.actions[actions.COPY],
			self.actions[actions.COPY_SOURCE],
			self.actions[actions.COPY_PREAMBLE],
			self.actions[actions.COPY_PREAMBLE_AND_SOURCE]
		)
		ActionFactory.addActionsToMenu(ordered_actions, copy_menu)
		self.actions[actions.COPY_MENU] = copy_menu
Example #5
0
	def _initToolBarActions(self, toolbar):
		actions_group = QActionGroup(self)
		show_logs_action = ActionFactory.createAction(toolbar, "Logs", "Show LaTeX preview logs", shortcut="Ctrl+L", slot=self.showLogsView, checkable=True)
		show_errors_action = ActionFactory.createAction(toolbar, "Errors", "Show LaTeX preview errors", shortcut="Ctrl+E", slot=self.showErrorsView, checkable=True)
		self.actions[actions.SHOW_LOGS] = show_logs_action
		self.actions[actions.SHOW_ERRORS] = show_errors_action

		actions_group.addAction(show_logs_action)
		actions_group.addAction(show_errors_action)
		ToolBarFactory.addItemsToToolBar((None, show_logs_action, show_errors_action, QLabel()), toolbar)
Example #6
0
	def _createEditMenu(self):
		edit_menu = self.menu_bar.addMenu("Edit")
		ordered_actions = (
			self.actions[actions.UNDO],
			self.actions[actions.REDO],
			None,
			self.actions[actions.CUT]
		)
		ActionFactory.addActionsToMenu(ordered_actions, edit_menu)
		self._createCopyMenu(edit_menu)
		ActionFactory.addActionsToMenu((self.actions[actions.PASTE], None), edit_menu)
		self._createSnippetsMenu(edit_menu)
Example #7
0
 def _createFileMenu(self):
     file_menu = self.menu_bar.addMenu("File")
     ordered_actions = (self.actions[actions.NEW],
                        self.actions[actions.OPEN], None,
                        self.actions[actions.CLOSE],
                        self.actions[actions.SAVE],
                        self.actions[actions.SAVE_AS],
                        self.actions[actions.SAVE_ALL], None,
                        self.actions[actions.PREVIEW], None,
                        self.actions[actions.ABOUT],
                        self.actions[actions.PREFERENCES],
                        self.actions[actions.QUIT])
     ActionFactory.addActionsToMenu(ordered_actions, file_menu)
Example #8
0
	def _initToolBarActions(self, toolbar):
		actions_group = QActionGroup(self)
		show_source_action = ActionFactory.createAction(toolbar, "Source", "Show LaTeX source editor", shortcut=QKeySequence.SelectStartOfLine, slot=self.showSourceView, checkable=True)
		show_preamble_action = ActionFactory.createAction(toolbar, "Preamble", "Show LaTeX preamble editor", shortcut=QKeySequence.SelectEndOfLine, slot=self.showPreambleView, checkable=True)
		self.actions[actions.SHOW_SOURCE] = show_source_action
		self.actions[actions.SHOW_PREAMBLE] = show_preamble_action

		show_source_action.setChecked(True)
		actions_group.addAction(show_source_action)
		actions_group.addAction(show_preamble_action)

		ToolBarFactory.addItemsToToolBar((
			self.app_controller.actions[actions.PREVIEW],
			("Copy", self.app_controller.actions[actions.COPY_MENU]),
			("Snippets", self.app_controller.actions[actions.SNIPPETS_MENU]),
			None, show_source_action, show_preamble_action,
			QLabel()), toolbar)
Example #9
0
	def _createFileMenu(self):
		file_menu = self.menu_bar.addMenu("File")
		ordered_actions = (
			self.actions[actions.NEW],
			self.actions[actions.OPEN],
			None,
			self.actions[actions.CLOSE],
			self.actions[actions.SAVE],
			self.actions[actions.SAVE_AS],
			self.actions[actions.SAVE_ALL],
			None,
			self.actions[actions.PREVIEW],
			None,
			self.actions[actions.ABOUT],
			self.actions[actions.PREFERENCES],
			self.actions[actions.QUIT]
		)
		ActionFactory.addActionsToMenu(ordered_actions, file_menu)
Example #10
0
	def loadSnippets(self):
		snippets_menu = self.actions[actions.SNIPPETS_MENU]
		snippets_menu.clear()
		snippets = Preferences.getSnippets()
		for snippet_name in sorted(snippets.iterkeys()):
			snippet_code = snippets[snippet_name]
			action = ActionFactory.createAction(self, snippet_name, "Insert \"%s\" Snippet" % snippet_name, None, self.insertSnippet)
			action.setData(QVariant(snippet_code))
			snippets_menu.addAction(action)
Example #11
0
	def _initToolBarActions(self):
		show_editor_action = ActionFactory.createAction(self.toolbar, "Editor", "Show editor's preferences", shortcut=None, slot=self.showEditorPreferences, checkable=True)
		show_document_action = ActionFactory.createAction(self.toolbar, "Document", "Show document's preferences", shortcut=None, slot=self.showDocumentPreferences, checkable=True)
		show_preview_action = ActionFactory.createAction(self.toolbar, "Preview", "Show preview's preferences", shortcut=None, slot=self.showPreviewPreferences, checkable=True)
		show_snippets_action = ActionFactory.createAction(self.toolbar, "Snippets", "Show snippets preferences", shortcut=None, slot=self.showSnippetsPreferences, checkable=True)
		self.actions[PreferencesView.SHOW_EDITOR_ACTION] = show_editor_action
		self.actions[PreferencesView.SHOW_DOCUMENT_ACTION] = show_document_action
		self.actions[PreferencesView.SHOW_PREVIEW_ACTION] = show_preview_action
		self.actions[PreferencesView.SHOW_SNIPPETS_ACTION] = show_snippets_action

		actions_group = QActionGroup(self)
		actions_group.addAction(show_editor_action)
		actions_group.addAction(show_document_action)
		actions_group.addAction(show_preview_action)
		actions_group.addAction(show_snippets_action)
		ToolBarFactory.addItemsToToolBar(
			(None, show_editor_action, show_document_action, show_preview_action, show_snippets_action, None),
			self.toolbar)
Example #12
0
    def _initToolBarActions(self):
        show_editor_action = ActionFactory.createAction(
            self.toolbar,
            "Editor",
            "Show editor's preferences",
            shortcut=None,
            slot=self.showEditorPreferences,
            checkable=True)
        show_document_action = ActionFactory.createAction(
            self.toolbar,
            "Document",
            "Show document's preferences",
            shortcut=None,
            slot=self.showDocumentPreferences,
            checkable=True)
        show_preview_action = ActionFactory.createAction(
            self.toolbar,
            "Preview",
            "Show preview's preferences",
            shortcut=None,
            slot=self.showPreviewPreferences,
            checkable=True)
        show_snippets_action = ActionFactory.createAction(
            self.toolbar,
            "Snippets",
            "Show snippets preferences",
            shortcut=None,
            slot=self.showSnippetsPreferences,
            checkable=True)
        self.actions[PreferencesView.SHOW_EDITOR_ACTION] = show_editor_action
        self.actions[
            PreferencesView.SHOW_DOCUMENT_ACTION] = show_document_action
        self.actions[PreferencesView.SHOW_PREVIEW_ACTION] = show_preview_action
        self.actions[
            PreferencesView.SHOW_SNIPPETS_ACTION] = show_snippets_action

        actions_group = QActionGroup(self)
        actions_group.addAction(show_editor_action)
        actions_group.addAction(show_document_action)
        actions_group.addAction(show_preview_action)
        actions_group.addAction(show_snippets_action)
        ToolBarFactory.addItemsToToolBar(
            (None, show_editor_action, show_document_action,
             show_preview_action, show_snippets_action, None), self.toolbar)
Example #13
0
    def _initToolBarActions(self, toolbar):
        actions_group = QActionGroup(self)
        show_logs_action = ActionFactory.createAction(
            toolbar,
            "Logs",
            "Show LaTeX preview logs",
            shortcut="Ctrl+L",
            slot=self.showLogsView,
            checkable=True)
        show_errors_action = ActionFactory.createAction(
            toolbar,
            "Errors",
            "Show LaTeX preview errors",
            shortcut="Ctrl+E",
            slot=self.showErrorsView,
            checkable=True)
        self.actions[actions.SHOW_LOGS] = show_logs_action
        self.actions[actions.SHOW_ERRORS] = show_errors_action

        actions_group.addAction(show_logs_action)
        actions_group.addAction(show_errors_action)
        ToolBarFactory.addItemsToToolBar(
            (None, show_logs_action, show_errors_action, QLabel()), toolbar)
Example #14
0
 def _createActions(self):
     self.actions[actions.ABOUT] = ActionFactory.createAction(
         self, "About", "About the application", None, self.about)
     self.actions[actions.CLOSE] = ActionFactory.createAction(
         self, "Close", "Close the window", QKeySequence.Close, self.close)
     self.actions[actions.COPY] = ActionFactory.createAction(
         self, "Copy", "Copy selected item", QKeySequence.Copy, self.copy)
     self.actions[actions.COPY_SOURCE] = ActionFactory.createAction(
         self, "Copy Source", "Copy the TikZ source", "Ctrl+Shift+C",
         self.copySource)
     self.actions[actions.COPY_PREAMBLE] = ActionFactory.createAction(
         self, "Copy Preamble", "Copy the preamble", "Ctrl+Shift+P",
         self.copyPreamble)
     self.actions[
         actions.COPY_PREAMBLE_AND_SOURCE] = ActionFactory.createAction(
             self, "Copy Preamble and Source",
             "Copy the TikZ source with preamble", None,
             self.copyPreambleAndSource)
     self.actions[actions.CUT] = ActionFactory.createAction(
         self, "Cut", "Cut selected item", QKeySequence.Cut, self.cut)
     self.actions[actions.NEW] = ActionFactory.createAction(
         self, "New", "Create a new document", QKeySequence.New, self.new)
     self.actions[actions.OPEN] = ActionFactory.createAction(
         self, "Open", "Open an existing document", QKeySequence.Open,
         self.open)
     self.actions[actions.PASTE] = ActionFactory.createAction(
         self, "Paste", "Paste content of clipboard", QKeySequence.Paste,
         self.paste)
     self.actions[actions.PREFERENCES] = ActionFactory.createAction(
         self, "Preferences", "Show the preferences window",
         QKeySequence.Preferences, self.showPreferences)
     self.actions[actions.PREFERENCES].setMenuRole(QAction.PreferencesRole)
     self.actions[actions.PREVIEW] = ActionFactory.createAction(
         self, "Preview", "Preview the document", QKeySequence.Print,
         self.preview)
     self.actions[actions.REDO] = ActionFactory.createAction(
         self, "Redo", "Redo last action", QKeySequence.Redo, self.redo)
     self.actions[actions.QUIT] = ActionFactory.createAction(
         self, "Quit", "Quit the application", QKeySequence.Quit, self.quit)
     self.actions[actions.SAVE] = ActionFactory.createAction(
         self, "Save", "Save the document", QKeySequence.Save, self.save)
     self.actions[actions.SAVE_ALL] = ActionFactory.createAction(
         self, "Save All", "Save all documents", None, self.saveAll)
     self.actions[actions.SAVE_AS] = ActionFactory.createAction(
         self, "Save As...", "Save the document as...", QKeySequence.SaveAs,
         self.saveAs)
     self.actions[actions.UNDO] = ActionFactory.createAction(
         self, "Undo", "Undo last action", QKeySequence.Undo, self.undo)
Example #15
0
	def _createActions(self):
		self.actions[actions.ABOUT] = ActionFactory.createAction(self, "About", "About the application", None, self.about)
		self.actions[actions.CLOSE] = ActionFactory.createAction(self, "Close", "Close the window", QKeySequence.Close, self.close)
		self.actions[actions.COPY] = ActionFactory.createAction(self, "Copy", "Copy selected item", QKeySequence.Copy, self.copy)
		self.actions[actions.COPY_SOURCE] = ActionFactory.createAction(self, "Copy Source", "Copy the TikZ source", "Ctrl+Shift+C", self.copySource)
		self.actions[actions.COPY_PREAMBLE] = ActionFactory.createAction(self, "Copy Preamble", "Copy the preamble", "Ctrl+Shift+P", self.copyPreamble)
		self.actions[actions.COPY_PREAMBLE_AND_SOURCE] = ActionFactory.createAction(self, "Copy Preamble and Source", "Copy the TikZ source with preamble", None, self.copyPreambleAndSource)
		self.actions[actions.CUT] = ActionFactory.createAction(self, "Cut", "Cut selected item", QKeySequence.Cut, self.cut)
		self.actions[actions.NEW] = ActionFactory.createAction(self, "New", "Create a new document", QKeySequence.New, self.new)
		self.actions[actions.OPEN] = ActionFactory.createAction(self, "Open", "Open an existing document", QKeySequence.Open, self.open)
		self.actions[actions.PASTE] = ActionFactory.createAction(self, "Paste", "Paste content of clipboard", QKeySequence.Paste, self.paste)
		self.actions[actions.PREFERENCES] = ActionFactory.createAction(self, "Preferences", "Show the preferences window", QKeySequence.Preferences, self.showPreferences)
		self.actions[actions.PREFERENCES].setMenuRole(QAction.PreferencesRole)
		self.actions[actions.PREVIEW] = ActionFactory.createAction(self, "Preview", "Preview the document", QKeySequence.Print, self.preview)
		self.actions[actions.REDO] = ActionFactory.createAction(self, "Redo", "Redo last action", QKeySequence.Redo, self.redo)
		self.actions[actions.QUIT] = ActionFactory.createAction(self, "Quit", "Quit the application", QKeySequence.Quit, self.quit)
		self.actions[actions.SAVE] = ActionFactory.createAction(self, "Save", "Save the document", QKeySequence.Save, self.save)
		self.actions[actions.SAVE_ALL] = ActionFactory.createAction(self, "Save All", "Save all documents", None, self.saveAll)
		self.actions[actions.SAVE_AS] = ActionFactory.createAction(self, "Save As...", "Save the document as...", QKeySequence.SaveAs, self.saveAs)
		self.actions[actions.UNDO] = ActionFactory.createAction(self, "Undo", "Undo last action", QKeySequence.Undo, self.undo)