diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f6d4c4d --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +.DS_Store +*.log +*.aux +*.pdf diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1ee456e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +TikZ-Editor +=========== \ No newline at end of file diff --git a/controllers/__init__.py b/controllers/__init__.py new file mode 100644 index 0000000..5a446b8 --- /dev/null +++ b/controllers/__init__.py @@ -0,0 +1,18 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from factory import ControllerFactory + +__all__ = ['ControllerFactory'] \ No newline at end of file diff --git a/controllers/about.py b/controllers/about.py new file mode 100644 index 0000000..ca0a675 --- /dev/null +++ b/controllers/about.py @@ -0,0 +1,37 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +import resources + +from tools import File + +class AboutController(QObject): + """ + Controller for the "About" dialog. + """ + def __init__(self): + super(AboutController, self).__init__() + self.view = None + self.app_controller = None + + def initController(self): + self.view.setImage(":/icon_about.png") + self.view.setInfoHTML(File.readContentFromFilePath(":/about.html")) + + @pyqtSlot() + def showAbout(self): + self.view.show() + self.view.raise_() \ No newline at end of file diff --git a/controllers/app.py b/controllers/app.py new file mode 100644 index 0000000..7f6bde8 --- /dev/null +++ b/controllers/app.py @@ -0,0 +1,309 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import os + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +import globals.actions as actions +from models import Preferences +from views import DocumentView +from views.editor import EditorView +from tools import addToClipboard, isMacintoshComputer +from tools import File, TemporaryDirectory +from tools.qt import ActionFactory, Dialogs + +class AppController(QObject): + """ + The application controller is directing all the user actions to sub-controllers. + """ + + def __init__(self): + super(AppController, self).__init__() + self.about_controller = None + self.documents_controller = None + self.preferences_controller = None + self.actions = {} + self.menu_bar = None + + def initController(self): + self._createActions() + self._createMenuBar() + + 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) + + def _createMenuBar(self): + self.menu_bar = QMenuBar() + self._createFileMenu() + self._createEditMenu() + + # set menu bar of about and preferences windows if we're not on Mac OS X + if not isMacintoshComputer(): + self.preferences_controller.view.setMenuBar(self.menu_bar) + self.about_controller.view.setMenuBar(self.menu_bar) + + + 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) + + 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) + + 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 + + def _createSnippetsMenu(self, edit_menu): + self.actions[actions.SNIPPETS_MENU] = edit_menu.addMenu("Insert Snippets") + self.loadSnippets() + + 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) + + @property + def focused_document(self): + """ + Returns the document having the focus. + """ + if not self.documentHasFocus(): + raise Exception("There is no document currently focused") + return QApplication.activeWindow().doc_controller + + def documentHasFocus(self): + """ + Returns whether a document currently has the focus. + """ + active_window = QApplication.activeWindow() + return isinstance(active_window, DocumentView) + + 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) + + @pyqtSlot() + def about(self): + try: + self.about_controller.showAbout() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def close(self): + try: + active_window = QApplication.activeWindow() + if active_window is not None: + active_window.close() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def copy(self): + self._doActionOnFocusedWidget("copy") + + @pyqtSlot() + def copySource(self): + try: + if self.documentHasFocus(): + addToClipboard(self.focused_document.model.source) + else: + QApplication.beep() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def copyPreamble(self): + try: + if self.documentHasFocus(): + addToClipboard(self.focused_document.model.preamble) + else: + QApplication.beep() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + 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) + + @pyqtSlot() + def cut(self): + self._doActionOnFocusedWidget("cut") + + @pyqtSlot() + def new(self): + try: + self.documents_controller.openEmptyDocument() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + 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) + + @pyqtSlot() + def paste(self): + self._doActionOnFocusedWidget("paste") + + @pyqtSlot() + def showPreferences(self): + try: + self.preferences_controller.showPreferences() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def preview(self): + try: + if self.documentHasFocus(): + self.focused_document.preview() + else: + QApplication.beep() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def redo(self): + self._doActionOnFocusedWidget("redo") + + @pyqtSlot() + def quit(self): + try: + self.documents_controller.closeAllDocuments() + TemporaryDirectory.delete() + QApplication.quit() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def save(self): + try: + if self.documentHasFocus(): + self.focused_document.save() + else: + QApplication.beep() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def saveAll(self): + try: + self.documents_controller.saveAllDocuments() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def saveAs(self): + try: + if self.documentHasFocus(): + self.focused_document.saveAs() + else: + QApplication.beep() + except Exception, e: + Dialogs.showError(e) + + @pyqtSlot() + def undo(self): + self._doActionOnFocusedWidget("undo") + + @pyqtSlot() + 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) \ No newline at end of file diff --git a/controllers/document.py b/controllers/document.py new file mode 100644 index 0000000..bc59009 --- /dev/null +++ b/controllers/document.py @@ -0,0 +1,96 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from tools import File +from tools.qt import Dialogs + +class DocumentController(QObject): + """ + The document controller is processing user actions on a document. + """ + figurePreviewOutOfSyncSignal = pyqtSignal() + figurePreviewChangedSignal = pyqtSignal(str, list) + documentClosedSignal = pyqtSignal(object) + + def __init__(self): + super(DocumentController, self).__init__() + self.app_controller = None + self.errors_controller = None + self.preview_controller = None + self.model = None + self.view = None + + def initController(self): + assert self.model and self.view + self._connectViewAndModel() + self._syncViewAndModel() + if not self.model.isEmpty(): + self.preview_controller.updatePreview() + + def _connectViewAndModel(self): + self.view.sourceChangedSignal.connect(self.model.setSource) + self.view.preambleChangedSignal.connect(self.model.setPreamble) + self.model.sourceChangedSignal.connect(self.view.setSource) + self.model.preambleChangedSignal.connect(self.view.setPreamble) + self.model.sourceChangedSignal.connect(self.preview_controller.documentContentChanged) + self.model.preambleChangedSignal.connect(self.preview_controller.documentContentChanged) + self.model.titleChangedSignal.connect(self.view.setTitle) + self.model.documentDirtiedSignal.connect(self.view.documentDirtied) + self.model.documentSavedSignal.connect(self.view.documentSaved) + self.preview_controller.willUpdatePreviewSignal.connect(self.errors_controller.clearErrors) + self.preview_controller.errorsInSourceSignal.connect(self.errors_controller.converterErrorsOccurred) + self.preview_controller.logsSignal.connect(self.view.feedback_view.logs_view.setLogs) + + def _syncViewAndModel(self): + self.view.preamble = self.model.preamble + self.view.source = self.model.source + self.view.title = self.model.title + + def showView(self): + self.view.show() + self.view.raise_() + + @pyqtSlot() + def preview(self): + self.preview_controller.updatePreview() + + @pyqtSlot() + def close(self): + self.preview_controller.abortPreview() + self.view.closeEvent() + self.documentClosedSignal.emit(self) + + @pyqtSlot() + def save(self): + if self.model.isUntitled(): + self.saveAs() + else: + self.model.save() + + @pyqtSlot() + def saveAs(self): + file_path = File.showSaveFileDialog(self.view, self._getDocumentFileName()) + if file_path: + self.model.file_path = file_path + self.model.save() + + def _getDocumentFileName(self): + file_name = self.model.file_path + if not file_name: + file_name = "%s.tex" % self.model.title + return file_name \ No newline at end of file diff --git a/controllers/documents.py b/controllers/documents.py new file mode 100644 index 0000000..f75032b --- /dev/null +++ b/controllers/documents.py @@ -0,0 +1,80 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +import controllers.factory +from app import AppController + +class DocumentsController(object): + """ + This is the documents manager. It keeps a list of all opened documents and can open + new or existing documents. + """ + + def __init__(self): + super(DocumentsController, self).__init__() + self.app_controller = None + self.documents = [] + + def openEmptyDocument(self): + doc = self._createDocument() + doc.view.content_view.source_editor_view.goToLine(2) + doc.showView() + + def openDocument(self, file_path): + """ + Opens an existing document at given file path and closes the startup document if + it is empty. + """ + assert file_path is not None + doc = self._createDocument(file_path) + doc.showView() + self._closeEmptyStartupDocument() + + def _createDocument(self, file_path=None): + """ + Creates a document controller and adds it to the docs list. + """ + doc = controllers.factory.ControllerFactory.createDocumentController(self.app_controller, file_path) + doc.documentClosedSignal.connect(self._documentClosed) + self.documents.append(doc) + return doc + + def _closeEmptyStartupDocument(self): + """ + Closes the startup document if it is empty. + """ + if len(self.documents) > 1 and self.documents[0].model.isUntitled() and self.documents[0].model.isEmpty(): + self.documents[0].view.close() + + def saveAllDocuments(self): + for d in self.documents: + if d.isDirty(): + d.save() + + def closeAllDocuments(self): + for d in self.documents: + d.close() + + @pyqtSlot() + def _documentClosed(self, document): + """ + Removes a closed document from the documents list. Called by the document + controller after the user closed the view. + """ + if document in self.documents: + self.documents.remove(document) \ No newline at end of file diff --git a/controllers/errors.py b/controllers/errors.py new file mode 100644 index 0000000..7903e64 --- /dev/null +++ b/controllers/errors.py @@ -0,0 +1,146 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from models import Preferences +from tools import documentIO + +class ConversionError(object): + def __init__(self, line, error): + super(ConversionError, self).__init__() + self.line = line + self.error = error + def __str__(self): + return self.error + +class PreambleError(ConversionError): + def __str__(self): + error = self.error + if self.line is not None: + error = "(preamble l.%d) %s" % (self.line, error) + return error + +class SourceError(ConversionError): + def __str__(self): + error = self.error + if self.line is not None: + error = "(source l.%d) %s" % (self.line, error) + return error + +class ErrorsController(QObject): + """ + The errors controller populates the errors list and error feedbacks (margin markers + and annotations). + """ + + # list of instances used to reload preferences + instances = [] + + @staticmethod + def reloadUserPreferences(): + for errors in ErrorsController.instances: + errors.loadUserPreferences() + + def __init__(self): + super(ErrorsController, self).__init__() + self.app_controller = None + self.doc_controller = None + self.content_view = None + self.errors_view = None + self.errors = [] + self.show_error_markers = None + self.show_error_annotations = None + ErrorsController.instances.append(self) + + def initController(self): + self.errors_view.errorSelectedSignal.connect(self.errorSelected) + self.loadUserPreferences() + + def loadUserPreferences(self): + self.show_error_markers = Preferences.getShowErrorMarkers() + self.show_error_annotations = Preferences.getShowErrorAnnotations() + self.clearErrorMarginMarkersAndAnnotations() + self._updateEditorsMarginsAndAnnotations() + + def errorSelected(self, error): + if isinstance(error, PreambleError): + self.content_view.showPreambleView() + self.content_view.preamble_editor_view.selectLine(error.line) + else: + self.content_view.showSourceView() + line = error.line + if not error.line: + line = 1 + self.content_view.source_editor_view.selectLine(line) + + def converterErrorsOccurred(self, errors, latex_source): + self.clearErrors() + self._matchErrorsToSource(errors, latex_source) + self._updateEditorsMarginsAndAnnotations() + self._updateErrorsList() + + def clearErrors(self): + self.errors = [] + self.errors_view.clearErrors() + self.clearErrorMarginMarkersAndAnnotations() + + def clearErrorMarginMarkersAndAnnotations(self): + self.content_view.source_editor_view.removeAllErrorMarginMarkers() + self.content_view.source_editor_view.removeAllAnnotations() + self.content_view.preamble_editor_view.removeAllErrorMarginMarkers() + self.content_view.preamble_editor_view.removeAllAnnotations() + + def _matchErrorsToSource(self, errors, latex_source): + """ + Sorts errors between LaTeX sections (preamble and source) according to file + template. + """ + (preamble_begin, preamble_end) = documentIO.getPreamblePositionFromSourceCode(latex_source) + (source_begin, source_end) = documentIO.getSourcePositionFromSourceCode(latex_source) + matched_errors = [] + for error in errors: + line = error[0] + message = error[1] + if line >= preamble_begin and line <= preamble_end: + matched_errors.append(PreambleError(line - preamble_begin + 1, message)) + elif line >= source_begin and line <= source_end: + matched_errors.append(SourceError(line - source_begin + 1, message)) + elif line > source_end: + matched_errors.append(ConversionError(source_end - source_begin + 1, message)) + else: + matched_errors.append(ConversionError(None, message)) + self.errors = matched_errors + + def _updateEditorsMarginsAndAnnotations(self): + for error in self.errors: + if isinstance(error, PreambleError): + self._addErrorToViewMarginsAndAnnotations(self.content_view.preamble_editor_view, error) + elif isinstance(error, SourceError) or isinstance(error, ConversionError): + self._addErrorToViewMarginsAndAnnotations(self.content_view.source_editor_view, error) + + def _addErrorToViewMarginsAndAnnotations(self, view, error): + line = error.line + if not line: + line = 1 + if self.show_error_markers: + view.addErrorMarginMarkerToLine(line) + if self.show_error_annotations: + view.addAnnotationToLine(line, error.error) + + def _updateErrorsList(self): + for error in self.errors: + self.errors_view.addError(error) \ No newline at end of file diff --git a/controllers/factory.py b/controllers/factory.py new file mode 100644 index 0000000..554b69e --- /dev/null +++ b/controllers/factory.py @@ -0,0 +1,101 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from app import AppController +from about import AboutController +from document import DocumentController +from documents import DocumentsController +from preview import PreviewController +from errors import ErrorsController +from preferences import PreferencesController + +from models import DocumentFactory +from views import ViewFactory + +class ControllerFactory(object): + """ + Factory of all controllers. + """ + + @staticmethod + def createAppController(): + app_controller = AppController() + app_controller.about_controller = ControllerFactory.createAboutController(app_controller) + app_controller.documents_controller = ControllerFactory.createDocumentsController(app_controller) + app_controller.preferences_controller = ControllerFactory.createPreferencesController(app_controller) + app_controller.initController() + return app_controller + + @staticmethod + def createAboutController(app_controller): + about_controller = AboutController() + about_controller.app_controller = app_controller + about_controller.view = ViewFactory.createAboutView(app_controller) + about_controller.initController() + return about_controller + + @staticmethod + def createDocumentController(app_controller, file_path=None): + doc_controller = DocumentController() + doc_controller.app_controller = app_controller + doc_view = ViewFactory.createDocumentView(app_controller, doc_controller) + + if file_path is None: + doc_model = DocumentFactory.createEmptyDocument() + else: + doc_model = DocumentFactory.createDocumentFromFilePath(file_path) + + errors_controller = ControllerFactory.createErrorsController(app_controller, doc_controller, doc_view) + doc_controller.errors_controller = errors_controller + preview_controller = ControllerFactory.createPreviewController(app_controller, doc_controller, doc_view) + doc_controller.preview_controller = preview_controller + + doc_controller.view = doc_view + doc_controller.model = doc_model + doc_controller.initController() + return doc_controller + + @staticmethod + def createErrorsController(app_controller, doc_controller, doc_view): + errors_controller = ErrorsController() + errors_controller.app_controller = app_controller + errors_controller.doc_controller = doc_controller + errors_controller.content_view = doc_view.content_view + errors_controller.errors_view = doc_view.feedback_view.errors_view + errors_controller.initController() + return errors_controller + + @staticmethod + def createPreviewController(app_controller, doc_controller, doc_view): + preview_controller = PreviewController() + preview_controller.app_controller = app_controller + preview_controller.doc_controller = doc_controller + preview_controller.preview_view = doc_view.preview_view + preview_controller.initController() + return preview_controller + + @staticmethod + def createDocumentsController(app_controller): + documents_controller = DocumentsController() + documents_controller.app_controller = app_controller + return documents_controller + + @staticmethod + def createPreferencesController(app_controller): + preferences_controller = PreferencesController() + preferences_controller.app_controller = app_controller + preferences_controller.view = ViewFactory.createPreferencesView(app_controller, preferences_controller) + preferences_controller.initController() + return preferences_controller \ No newline at end of file diff --git a/controllers/preferences.py b/controllers/preferences.py new file mode 100644 index 0000000..48ee4f0 --- /dev/null +++ b/controllers/preferences.py @@ -0,0 +1,89 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * + +from models import Preferences +from controllers.errors import ErrorsController +from views.editor import EditorView + +class PreferencesController(QObject): + """ + Controller of the "Preferences" dialog. It basically connects and syncs user defaults + with the preferences dialog. + """ + + def __init__(self): + super(PreferencesController, self).__init__() + self.app_controller = None + self.view = None + + def initController(self): + assert self.view + self._connectViewAndModel() + self._syncViewAndModel() + + def _connectViewAndModel(self): + self.view.editor.editorFontChangedSignal.connect(Preferences.setEditorFont) + self.view.editor.fileEncodingChangedSignal.connect(Preferences.setFileEncoding) + self.view.editor.lineEndingsChangedSignal.connect(Preferences.setLineEndings) + self.view.editor.indentationTypeChangedSignal.connect(Preferences.setIndentationType) + self.view.editor.indentationSizeChangedSignal.connect(Preferences.setIndentationSize) + self.view.editor.autoWrapChangedSignal.connect(Preferences.setAutoWrap) + self.view.editor.errorMarkersChangedSignal.connect(Preferences.setShowErrorMarkers) + self.view.editor.errorAnnotationsChangedSignal.connect(Preferences.setShowErrorAnnotations) + + self.view.editor.editorFontChangedSignal.connect(EditorView.reloadUserPreferences) + self.view.editor.fileEncodingChangedSignal.connect(EditorView.reloadUserPreferences) + self.view.editor.lineEndingsChangedSignal.connect(EditorView.reloadUserPreferences) + self.view.editor.indentationTypeChangedSignal.connect(EditorView.reloadUserPreferences) + self.view.editor.indentationSizeChangedSignal.connect(EditorView.reloadUserPreferences) + self.view.editor.autoWrapChangedSignal.connect(EditorView.reloadUserPreferences) + self.view.editor.errorMarkersChangedSignal.connect(ErrorsController.reloadUserPreferences) + self.view.editor.errorAnnotationsChangedSignal.connect(ErrorsController.reloadUserPreferences) + + self.view.document.preambleTemplateChangedSignal.connect(Preferences.setPreambleTemplate) + self.view.document.latexFileTemplateChangedSignal.connect(Preferences.setLatexFileTemplate) + + self.view.preview.previewTemplateChangedSignal.connect(Preferences.setPreviewTemplate) + self.view.preview.latexToPDFCommandChangedSignal.connect(Preferences.setLatexToPDFCommand) + self.view.preview.PDFToImageCommandChangedSignal.connect(Preferences.setPDFToImageCommand) + + self.view.snippets.snippetsChangedSignal.connect(Preferences.setSnippets) + self.view.snippets.snippetsChangedSignal.connect(self.app_controller.loadSnippets) + + def _syncViewAndModel(self): + self.view.editor.editor_font = Preferences.getEditorFont() + self.view.editor.file_encoding = Preferences.getFileEncoding() + self.view.editor.line_endings = Preferences.getLineEndings() + self.view.editor.indentation_type = Preferences.getIndentationType() + self.view.editor.indentation_size = Preferences.getIndentationSize() + self.view.editor.auto_wrap = Preferences.getAutoWrap() + self.view.editor.error_markers = Preferences.getShowErrorMarkers() + self.view.editor.error_annotations = Preferences.getShowErrorAnnotations() + + self.view.document.latex_file_template = Preferences.getLatexFileTemplate() + self.view.document.preamble_template = Preferences.getPreambleTemplate() + + self.view.preview.preview_template = Preferences.getPreviewTemplate() + self.view.preview.latex_to_pdf_command = Preferences.getLatexToPDFCommand() + self.view.preview.pdf_to_image_command = Preferences.getPDFToImageCommand() + + self.view.snippets.snippets = Preferences.getSnippets() + + @pyqtSlot() + def showPreferences(self): + self.view.show() + self.view.raise_() \ No newline at end of file diff --git a/controllers/preview.py b/controllers/preview.py new file mode 100644 index 0000000..92ea256 --- /dev/null +++ b/controllers/preview.py @@ -0,0 +1,101 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from datetime import datetime + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from models import Preferences +from tools.latex2image import Converter, LatexToImageConversion +from tools import documentIO +from tools import TemporaryDirectory + +class PreviewController(QObject): + """ + The preview controller converts when necessary or requested the document source to an + image displayed in the preview view. + """ + willUpdatePreviewSignal = pyqtSignal() + errorsInSourceSignal = pyqtSignal(list, str) + logsSignal = pyqtSignal(str) + + def __init__(self): + super(PreviewController, self).__init__() + self.app_controller = None + self.doc_controller = None + self.preview_view = None + self.latex2image_converter = None + self.request_preview_update = False + self.last_time_content_changed = datetime.now() + + def initController(self): + temp_dir = TemporaryDirectory.get() + self.latex2image_converter = Converter(temp_dir) + self.latex2image_converter.convertedSignal.connect(self.previewGenerated) + self.latex2image_converter.conversionAbortedSignal.connect(self.conversionAborted) + + @pyqtSlot(str) + def documentContentChanged(self, content): + self.last_time_content_changed = datetime.now() + self.preview_view.showWaitingBackground() + if not self.request_preview_update: + self.requestPreviewUpdate() + + @pyqtSlot() + def conversionAborted(self): + self.preview_view.showErrorBackground() + + def requestPreviewUpdate(self): + self.request_preview_update = True + if self._isEndOfInstruction(): + self.updatePreview() + else: + self.updatePreviewAfterTypingPause() + + def _isEndOfInstruction(self): + """ + Returns whether the last typed character is a semi-colon, meaning the + end of current TikZ instruction + """ + return (self.doc_controller.view.content_view.current_editor_view.getCharacterAtCurrentCursorPosition() == ";") + + def updatePreviewAfterTypingPause(self): + """ + Updates the preview when the user is making a pause while typing. + """ + if (datetime.now() - self.last_time_content_changed).microseconds >= 500000: + self.updatePreview() + else: + QTimer.singleShot(400, self.updatePreviewAfterTypingPause) + + def updatePreview(self): + self.request_preview_update = False + doc = self.doc_controller.model + template = Preferences.getPreviewTemplate() + source = documentIO.buildFileContentFromDocument(template, doc) + self.latex2image_converter.convertLatexToImage(source) + + def abortPreview(self): + self.latex2image_converter.stopConversion() + + @pyqtSlot(LatexToImageConversion) + def previewGenerated(self, conversion): + self.willUpdatePreviewSignal.emit() + if conversion.image_path: + self.preview_view.figure = conversion.image_path + self.preview_view.showNormalBackground() + self.logsSignal.emit(conversion.logs) + self.errorsInSourceSignal.emit(conversion.errors, conversion.source) \ No newline at end of file diff --git a/globals/__init__.py b/globals/__init__.py new file mode 100644 index 0000000..d32951f --- /dev/null +++ b/globals/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +APPLICATION_NAME = u"TikZ Editor" +ORGANIZATION_NAME = u"UPMC" +ORGANIZATION_DOMAIN = u"upmc.fr" +AUTHORS = u"Mickaël Menu" # add authors separated by commas -- accents must be encoded as HTML entities +VERSION = u"1.0" +GIT_VERSION = u"" # returned by "git describe --always" in the GIT repository \ No newline at end of file diff --git a/globals/actions.py b/globals/actions.py new file mode 100644 index 0000000..e0dad77 --- /dev/null +++ b/globals/actions.py @@ -0,0 +1,44 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +# user actions +ABOUT = "about" +CLOSE = "close" +COPY = "copy" +COPY_SOURCE = "copySource" +COPY_PREAMBLE = "copyPreamble" +COPY_PREAMBLE_AND_SOURCE = "copyPreambleAndSource" +CUT = "cut" +NEW = "new" +OPEN = "open" +PASTE = "paste" +PREFERENCES = "preferences" +PREVIEW = "preview" +REDO = "redo" +QUIT = "quit" +SAVE = "save" +SAVE_ALL = "saveAll" +SAVE_AS = "saveAs" +SHOW_ERRORS = "showErrors" +SHOW_LOGS = "showLogs" +SHOW_PREAMBLE = "showPreamble" +SHOW_SOURCE = "showSource" +UNDO = "undo" + +# menus +FILE_MENU = "fileMenu" +EDIT_MENU = "editMenu" +COPY_MENU = "copyMenu" +SNIPPETS_MENU = "snippetsMenu" \ No newline at end of file diff --git a/globals/defaults.py b/globals/defaults.py new file mode 100644 index 0000000..1bb6cfe --- /dev/null +++ b/globals/defaults.py @@ -0,0 +1,56 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +# Default user preferences +EDITOR_FONT = u'Monaco, Courrier,13,-1,5,50,0,0,0,1,0' +FILE_ENCODING = "UTF-8" # UTF-8, LATIN-1 +INDENTATION_TYPE = "tab" # tab, spaces +INDENTATION_SIZE = 4 +AUTO_WRAP = True +SHOW_ERROR_MARKERS = True +SHOW_ERROR_ANNOTATIONS = True + +DEFAULT_PREAMBLE_TEMPLATE = u'' +DEFAULT_TEMPLATE = u"""\\documentclass{article} +\\usepackage{tikz} +\\usepackage[graphics, active, tightpage]{preview} +\\PreviewEnvironment{tikzpicture}\n +$PREAMBLE\n +\\begin{document} +$SOURCE +\\end{document}""" + +DEFAULT_LATEX_TO_PDF_COMMAND = u'pdflatex' +# placeholders: $OUTPUT_DIR, $FILE_NAME, $FILE_PATH +DEFAULT_LATEX_TO_PDF_ARGS = u'%s -file-line-error -interaction=nonstopmode -output-directory $OUTPUT_DIR -jobname $FILE_NAME $FILE_PATH' +DEFAULT_MAC_PDF_TO_IMAGE_COMMAND = u'sips' +# placeholders: $PDF_PATH, $IMAGE_PATH +DEFAULT_MAC_PDF_TO_IMAGE_ARGS = u'%s -s format png $PDF_PATH --out $IMAGE_PATH' +DEFAULT_PDF_TO_IMAGE_COMMAND = u'convert' +# placeholders: $PDF_PATH, $IMAGE_PATH +DEFAULT_PDF_TO_IMAGE_ARGS = u'%s -density 150 $PDF_PATH -quality 90 -transparent white $IMAGE_PATH' + +SNIPPETS = { + u'Draw': u'\\draw @@@;', + u'Draw () -- ()': u'\\draw (@@@) -- ();', + u'Node': u'\\node (@@@) {};', + u'Fill': u'\\fill[@@@] ;', + u'Filldraw': u'\\filldraw[fill=@@@, draw=] ;', + u'Path': u'\\path @@@;', + u'Foreach': u'\\foreach @@@ in {}', + u'Foreach x': u'\\foreach \\x in {@@@}', + u'Tabular': u"""\\begin{tabular}{@@@} +\end{tabular}""" +} \ No newline at end of file diff --git a/globals/editor.py b/globals/editor.py new file mode 100644 index 0000000..115f9d0 --- /dev/null +++ b/globals/editor.py @@ -0,0 +1,42 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +# List of TikZ commands used for syntax highlighting +TIKZ_KEYWORDS = ('node', 'draw', 'tikzstyle', 'begin', 'end') + +# Default +EDITOR_TEXT_COLOR = '#000000' +EDITOR_TEXT_BOLD = False +EDITOR_TEXT_ITALIC = False + +# LaTeX commands prefixed by \ +EDITOR_KEYWORDS_COLOR = '#007F00' +EDITOR_KEYWORDS_BOLD = True +EDITOR_KEYWORDS_ITALIC = False + +# LaTeX comments +EDITOR_COMMENTS_COLOR = '#1F74E0' +EDITOR_COMMENTS_BOLD = False +EDITOR_COMMENTS_ITALIC = True + +# Symbols ()[]<>= +EDITOR_SYMBOLS1_COLOR = '#0000C8' +EDITOR_SYMBOLS1_BOLD = False +EDITOR_SYMBOLS1_ITALIC = False + +# Symbols {}$ +EDITOR_SYMBOLS2_COLOR = '#C80000' +EDITOR_SYMBOLS2_BOLD = False +EDITOR_SYMBOLS2_ITALIC = False \ No newline at end of file diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..8ad7a53 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from document import DocumentModel, DocumentError +from preferences import PreferencesModel as Preferences +from factory import DocumentFactory + +__all__ = ["DocumentModel", "DocumentError", "DocumentFactory", "Preferences"] diff --git a/models/document.py b/models/document.py new file mode 100644 index 0000000..f712b94 --- /dev/null +++ b/models/document.py @@ -0,0 +1,152 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from preferences import PreferencesModel as Preferences +from tools import File +from tools import documentIO + +class DocumentError(Exception): + pass + +class DocumentModel(QObject): + """ + The document model represents a TikZ document, that is composed of a preamble and a + source. + """ + + LAST_CREATED_DOCUMENT_ID = 0 + DEFAULT_SOURCE = unicode("\\begin{tikzpicture}\n\n\\end{tikzpicture}") + + sourceChangedSignal = pyqtSignal(str) + preambleChangedSignal = pyqtSignal(str) + titleChangedSignal = pyqtSignal(str) + documentDirtiedSignal = pyqtSignal() + documentSavedSignal = pyqtSignal() + + def __init__(self, file_path=None): + super(DocumentModel, self).__init__() + self.id = self._createDocumentId() + self._preamble = Preferences.getPreambleTemplate() + self._source = DocumentModel.DEFAULT_SOURCE + self._dirty = False + self._file_path = file_path + + def _createDocumentId(self): + DocumentModel.LAST_CREATED_DOCUMENT_ID += 1 + return DocumentModel.LAST_CREATED_DOCUMENT_ID + + def open(self): + """ + To open the document, we read the content from the file path and un- + dirty the document. + """ + try: + if File.exists(self.file_path): + (self.preamble, self.source) = documentIO.readPreambleAndSourceFromFilePath(self.file_path) + self.dirty = False + except Exception, e: + raise DocumentError("The document cannot be opened: %s" % unicode(e)) + + def save(self): + """ + To save the document, we write the content to the file path and un- + dirty the document. + """ + try: + template = Preferences.getLatexFileTemplate() + documentIO.writeDocumentToFilePath(template, self, self.file_path) + self.dirty = False + except Exception, e: + raise DocumentError("The document cannot be saved: %s" % unicode(e)) + + @property + def file_path(self): + return self._file_path + + @file_path.setter + def file_path(self, file_path): + if self._file_path != file_path: + self._file_path = file_path + self.titleChangedSignal.emit(self.title) + + @property + def title(self): + """ + The title of a document is the file name of the document or + "Untitled [ID]" if the document is untitled. + """ + if self.isUntitled(): + title = "Untitled %d" % self.id + else: + title = File.getFileNameFromFilePath(self.file_path) + return title + + @property + def dirty(self): + return self._dirty + + @dirty.setter + def dirty(self, dirty): + if self._dirty != dirty: + self._dirty = dirty + if dirty: + self.documentDirtiedSignal.emit() + else: + self.documentSavedSignal.emit() + + @property + def source(self): + return self._source + + @source.setter + def source(self, source): + source = unicode(source) + if self._source != source: + self._source = source + self.sourceChangedSignal.emit(source) + self.dirty = True + + @pyqtSlot(str) + def setSource(self, source): + self.source = source + + @property + def preamble(self): + return self._preamble + + @preamble.setter + def preamble(self, preamble): + preamble = unicode(preamble) + if self._preamble != preamble: + self._preamble = preamble + self.preambleChangedSignal.emit(preamble) + self.dirty = True + + @pyqtSlot(str) + def setPreamble(self, preamble): + self.preamble = preamble + + def isDirty(self): + return self.dirty + + def isUntitled(self): + # an untitled document has no file path. + return self.file_path is None or self.file_path == "" + + def isEmpty(self): + return (self.preamble == Preferences.getPreambleTemplate() and self.source == DocumentModel.DEFAULT_SOURCE) \ No newline at end of file diff --git a/models/factory.py b/models/factory.py new file mode 100644 index 0000000..26ce56d --- /dev/null +++ b/models/factory.py @@ -0,0 +1,31 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from document import DocumentModel + +class DocumentFactory(object): + """ + Factory of document models. + """ + @staticmethod + def createEmptyDocument(): + return DocumentModel() + + @staticmethod + def createDocumentFromFilePath(file_path): + assert file_path is not None + d = DocumentModel(file_path) + d.open() + return d \ No newline at end of file diff --git a/models/preferences.py b/models/preferences.py new file mode 100644 index 0000000..012d6a3 --- /dev/null +++ b/models/preferences.py @@ -0,0 +1,444 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +import globals.defaults as defaults +from tools import isMacintoshComputer, isWindowsComputer, findCommandLocation + +class PreferencesModel(object): + """ + The preferences model is a wrapper for QT's QSettings allowing easy retrieval of user + defaults. + """ + + WINDOW_GEOMETRY = "WindowGeometry" + EDITOR_SPLITTER_STATE = "EditorSplitterState" + MAIN_SPLITTER_STATE = "MainSplitterState" + SELECTED_FEEDBACK_VIEW = "SelectedFeedbackView" + LATEX_FILE_TEMPLATE = "LatexFileTemplate" + PREAMBLE_TEMPLATE = "PreambleTemplate" + PREVIEW_TEMPLATE = "PreviewTemplate" + LATEX_TO_PDF_COMMAND = "LatexToPDFCommand" + PDF_TO_IMAGE_COMMAND = "PDFToImageCommand" + EDITOR_FONT = "EditorFont" + FILE_ENCODING = "FileEncoding" + LINE_ENDINGS = "LineEndings" + INDENTATION_TYPE = "IndentationType" + INDENTATION_SIZE = "IndentationSize" + AUTO_WRAP = "AutoWrap" + SHOW_ERROR_MARKERS = "ShowErrorMarkers" + SHOW_ERROR_ANNOTATIONS = "ShowErrorAnnotations" + SNIPPETS = "Snippets" + + FEEDBACK_LOGS_VIEW = 0 + FEEDBACK_ERRORS_VIEW = 1 + ENCODING_UTF8 = 1 + ENCODING_LATIN1 = 2 + LINE_ENDINGS_WINDOWS = 1 + LINE_ENDINGS_MAC = 2 + LINE_ENDINGS_UNIX = 3 + INDENT_TAB = 1 + INDENT_SPACES = 2 + + @staticmethod + def containsKey(key): + settings = QSettings() + return settings.contains(key) + + @staticmethod + def getValue(key): + return PreferencesModel.getValueOrDefault(key, None) + + @staticmethod + def getValueOrDefault(key, default_value): + settings = QSettings() + if default_value is not None: + value = settings.value(key, QVariant(default_value)) + else: + value = settings.value(key) + return value + + @staticmethod + def setValue(key, value): + settings = QSettings() + settings.setValue(key, QVariant(value)) + + @staticmethod + def removeKey(key): + settings = QSettings() + settings.remove(key) + +################################################################################ + + @staticmethod + def hasWindowGeometry(): + return PreferencesModel.containsKey(PreferencesModel.WINDOW_GEOMETRY) + + @staticmethod + def getWindowGeometry(): + return PreferencesModel.getValue(PreferencesModel.WINDOW_GEOMETRY).toByteArray() + + @staticmethod + def setWindowGeometry(value): + PreferencesModel.setValue(PreferencesModel.WINDOW_GEOMETRY, value) + + + @staticmethod + def hasEditorSplitterState(): + return PreferencesModel.containsKey(PreferencesModel.EDITOR_SPLITTER_STATE) + + @staticmethod + def getEditorSplitterState(): + return PreferencesModel.getValue(PreferencesModel.EDITOR_SPLITTER_STATE).toByteArray() + + @staticmethod + def setEditorSplitterState(value): + PreferencesModel.setValue(PreferencesModel.EDITOR_SPLITTER_STATE, value) + + + @staticmethod + def hasMainSplitterState(): + return PreferencesModel.containsKey(PreferencesModel.MAIN_SPLITTER_STATE) + + @staticmethod + def getMainSplitterState(): + return PreferencesModel.getValue(PreferencesModel.MAIN_SPLITTER_STATE).toByteArray() + + @staticmethod + def setMainSplitterState(value): + PreferencesModel.setValue(PreferencesModel.MAIN_SPLITTER_STATE, value) + + + @staticmethod + def hasSelectedFeedbackView(): + return PreferencesModel.containsKey(PreferencesModel.SELECTED_FEEDBACK_VIEW) + + @staticmethod + def getSelectedFeedbackView(): + value = PreferencesModel.getValueOrDefault(PreferencesModel.SELECTED_FEEDBACK_VIEW, PreferencesModel.defaultSelectedFeedbackView()).toInt() + convert_success = value[1] + value = value[0] + if not (convert_success and value in (PreferencesModel.FEEDBACK_LOGS_VIEW, PreferencesModel.FEEDBACK_ERRORS_VIEW)): + value = PreferencesModel.defaultSelectedFeedbackView() + return value + + @staticmethod + def setSelectedFeedbackView(value): + PreferencesModel.setValue(PreferencesModel.SELECTED_FEEDBACK_VIEW, value) + + @staticmethod + def defaultSelectedFeedbackView(): + return PreferencesModel.FEEDBACK_LOGS_VIEW + +################################################################################ + + @staticmethod + def hasEditorFont(): + return PreferencesModel.containsKey(PreferencesModel.EDITOR_FONT) + + @staticmethod + def getEditorFont(): + font = QFont() + font.fromString(PreferencesModel.getValueOrDefault(PreferencesModel.EDITOR_FONT, PreferencesModel.defaultEditorFont()).toString()) + return font + + @staticmethod + def setEditorFont(value): + PreferencesModel.setValue(PreferencesModel.EDITOR_FONT, value.toString()) + + @staticmethod + def defaultEditorFont(): + return defaults.EDITOR_FONT + + + @staticmethod + def hasFileEncoding(): + return PreferencesModel.containsKey(PreferencesModel.FILE_ENCODING) + + @staticmethod + def getFileEncoding(): + value = PreferencesModel.getValueOrDefault(PreferencesModel.FILE_ENCODING, PreferencesModel.defaultFileEncoding()).toInt() + convert_success = value[1] + value = value[0] + if not (convert_success and value in (PreferencesModel.ENCODING_LATIN1, PreferencesModel.ENCODING_UTF8)): + value = PreferencesModel.defaultFileEncoding() + return value + + + @staticmethod + def setFileEncoding(value): + assert value in (PreferencesModel.ENCODING_LATIN1, PreferencesModel.ENCODING_UTF8) + PreferencesModel.setValue(PreferencesModel.FILE_ENCODING, value) + + @staticmethod + def defaultFileEncoding(): + default = PreferencesModel.ENCODING_UTF8 + if defaults.FILE_ENCODING == "LATIN-1": + default = PreferencesModel.ENCODING_LATIN1 + return default + + + @staticmethod + def hasLineEndings(): + return PreferencesModel.containsKey(PreferencesModel.LINE_ENDINGS) + + @staticmethod + def getLineEndings(): + value = PreferencesModel.getValueOrDefault(PreferencesModel.LINE_ENDINGS, PreferencesModel.defaultLineEndings()).toInt() + convert_success = value[1] + value = value[0] + if not (convert_success and value in (PreferencesModel.LINE_ENDINGS_UNIX, PreferencesModel.LINE_ENDINGS_MAC, PreferencesModel.LINE_ENDINGS_WINDOWS)): + value = PreferencesModel.defaultLineEndings() + return value + + @staticmethod + def setLineEndings(value): + assert value in (PreferencesModel.LINE_ENDINGS_UNIX, PreferencesModel.LINE_ENDINGS_MAC, PreferencesModel.LINE_ENDINGS_WINDOWS) + PreferencesModel.setValue(PreferencesModel.LINE_ENDINGS, value) + + @staticmethod + def defaultLineEndings(): + default = PreferencesModel.LINE_ENDINGS_UNIX + if isWindowsComputer(): + default = PreferencesModel.LINE_ENDINGS_WINDOWS + return default + + + @staticmethod + def hasIndentationType(): + return PreferencesModel.containsKey(PreferencesModel.INDENTATION_TYPE) + + @staticmethod + def getIndentationType(): + value = PreferencesModel.getValueOrDefault(PreferencesModel.INDENTATION_TYPE, PreferencesModel.defaultIndentationType()).toInt() + convert_success = value[1] + value = value[0] + if not (convert_success and value in (PreferencesModel.INDENT_TAB, PreferencesModel.INDENT_SPACES)): + value = PreferencesModel.defaultIndentationType() + return value + + @staticmethod + def setIndentationType(value): + assert value in (PreferencesModel.INDENT_SPACES, PreferencesModel.INDENT_TAB) + PreferencesModel.setValue(PreferencesModel.INDENTATION_TYPE, value) + + @staticmethod + def defaultIndentationType(): + default = PreferencesModel.INDENT_TAB + if defaults.INDENTATION_TYPE == "spaces": + default = PreferencesModel.INDENT_SPACES + return default + + + @staticmethod + def hasIndentationSize(): + return PreferencesModel.containsKey(PreferencesModel.INDENTATION_SIZE) + + @staticmethod + def getIndentationSize(): + value = PreferencesModel.getValueOrDefault(PreferencesModel.INDENTATION_SIZE, PreferencesModel.defaultIndentationSize()).toInt() + convert_success = value[1] + value = value[0] + if not (convert_success and value > 0): + value = PreferencesModel.defaultIndentationSize() + return value + + @staticmethod + def setIndentationSize(value): + assert value > 0 + PreferencesModel.setValue(PreferencesModel.INDENTATION_SIZE, value) + + @staticmethod + def defaultIndentationSize(): + return defaults.INDENTATION_SIZE + + + @staticmethod + def hasAutoWrap(): + return PreferencesModel.containsKey(PreferencesModel.AUTO_WRAP) + + @staticmethod + def getAutoWrap(): + return PreferencesModel.getValueOrDefault(PreferencesModel.AUTO_WRAP, PreferencesModel.defaultAutoWrap()).toBool() + + @staticmethod + def setAutoWrap(value): + PreferencesModel.setValue(PreferencesModel.AUTO_WRAP, value) + + @staticmethod + def defaultAutoWrap(): + return defaults.AUTO_WRAP + + + @staticmethod + def hasShowErrorMarkers(): + return PreferencesModel.containsKey(PreferencesModel.SHOW_ERROR_MARKERS) + + @staticmethod + def getShowErrorMarkers(): + return PreferencesModel.getValueOrDefault(PreferencesModel.SHOW_ERROR_MARKERS, PreferencesModel.defaultShowErrorMarkers()).toBool() + + @staticmethod + def setShowErrorMarkers(value): + PreferencesModel.setValue(PreferencesModel.SHOW_ERROR_MARKERS, value) + + @staticmethod + def defaultShowErrorMarkers(): + return defaults.SHOW_ERROR_MARKERS + + + @staticmethod + def hasShowErrorAnnotations(): + return PreferencesModel.containsKey(PreferencesModel.SHOW_ERROR_ANNOTATIONS) + + @staticmethod + def getShowErrorAnnotations(): + return PreferencesModel.getValueOrDefault(PreferencesModel.SHOW_ERROR_ANNOTATIONS, PreferencesModel.defaultShowErrorAnnotations()).toBool() + + @staticmethod + def setShowErrorAnnotations(value): + PreferencesModel.setValue(PreferencesModel.SHOW_ERROR_ANNOTATIONS, value) + + @staticmethod + def defaultShowErrorAnnotations(): + return defaults.SHOW_ERROR_MARKERS + +################################################################################ + + @staticmethod + def hasLatexFileTemplate(): + return PreferencesModel.containsKey(PreferencesModel.LATEX_FILE_TEMPLATE) + + @staticmethod + def getLatexFileTemplate(): + return unicode(PreferencesModel.getValueOrDefault(PreferencesModel.LATEX_FILE_TEMPLATE, PreferencesModel.defaultLatexFileTemplate()).toString()) + + @staticmethod + def setLatexFileTemplate(value): + PreferencesModel.setValue(PreferencesModel.LATEX_FILE_TEMPLATE, value) + + @staticmethod + def defaultLatexFileTemplate(): + return defaults.DEFAULT_TEMPLATE + + + @staticmethod + def hasPreambleTemplate(): + return PreferencesModel.containsKey(PreferencesModel.PREAMBLE_TEMPLATE) + + @staticmethod + def getPreambleTemplate(): + return unicode(PreferencesModel.getValueOrDefault(PreferencesModel.PREAMBLE_TEMPLATE, PreferencesModel.defaultPreambleTemplate()).toString()) + + @staticmethod + def setPreambleTemplate(value): + PreferencesModel.setValue(PreferencesModel.PREAMBLE_TEMPLATE, value) + + @staticmethod + def defaultPreambleTemplate(): + return defaults.DEFAULT_PREAMBLE_TEMPLATE + + +################################################################################ + + @staticmethod + def hasPreviewTemplate(): + return PreferencesModel.containsKey(PreferencesModel.PREVIEW_TEMPLATE) + + @staticmethod + def getPreviewTemplate(): + return unicode(PreferencesModel.getValueOrDefault(PreferencesModel.PREVIEW_TEMPLATE, PreferencesModel.defaultPreviewTemplate()).toString()) + + @staticmethod + def setPreviewTemplate(value): + PreferencesModel.setValue(PreferencesModel.PREVIEW_TEMPLATE, value) + + @staticmethod + def defaultPreviewTemplate(): + return defaults.DEFAULT_TEMPLATE + + + + DEFAULT_LATEX_TO_PDF_COMMAND = None + + @staticmethod + def hasLatexToPDFCommand(): + return PreferencesModel.containsKey(PreferencesModel.LATEX_TO_PDF_COMMAND) + + @staticmethod + def getLatexToPDFCommand(): + return unicode(PreferencesModel.getValueOrDefault(PreferencesModel.LATEX_TO_PDF_COMMAND, PreferencesModel.defaultLatexToPDFCommand()).toString()) + + @staticmethod + def setLatexToPDFCommand(value): + PreferencesModel.setValue(PreferencesModel.LATEX_TO_PDF_COMMAND, value) + + @staticmethod + def defaultLatexToPDFCommand(): + if PreferencesModel.DEFAULT_LATEX_TO_PDF_COMMAND is None: + pdflatex_path = findCommandLocation(defaults.DEFAULT_LATEX_TO_PDF_COMMAND) + PreferencesModel.DEFAULT_LATEX_TO_PDF_COMMAND = defaults.DEFAULT_LATEX_TO_PDF_ARGS % pdflatex_path + return PreferencesModel.DEFAULT_LATEX_TO_PDF_COMMAND + + + DEFAULT_PDF_TO_IMAGE_COMMAND = None + + @staticmethod + def hasPDFToImageCommand(): + return PreferencesModel.containsKey(PreferencesModel.PDF_TO_IMAGE_COMMAND) + + @staticmethod + def getPDFToImageCommand(): + return unicode(PreferencesModel.getValueOrDefault(PreferencesModel.PDF_TO_IMAGE_COMMAND, PreferencesModel.defaultPDFToImageCommand()).toString()) + + @staticmethod + def setPDFToImageCommand(value): + PreferencesModel.setValue(PreferencesModel.PDF_TO_IMAGE_COMMAND, value) + + @staticmethod + def defaultPDFToImageCommand(): + if PreferencesModel.DEFAULT_PDF_TO_IMAGE_COMMAND is None: + if isMacintoshComputer(): + sips_path = findCommandLocation(defaults.DEFAULT_MAC_PDF_TO_IMAGE_COMMAND) + PreferencesModel.DEFAULT_PDF_TO_IMAGE_COMMAND = defaults.DEFAULT_MAC_PDF_TO_IMAGE_ARGS % sips_path + else: + convert_path = findCommandLocation(defaults.DEFAULT_PDF_TO_IMAGE_COMMAND) + PreferencesModel.DEFAULT_PDF_TO_IMAGE_COMMAND = defaults.DEFAULT_PDF_TO_IMAGE_ARGS % convert_path + return PreferencesModel.DEFAULT_PDF_TO_IMAGE_COMMAND + +################################################################################ + + @staticmethod + def hasSnippets(): + return PreferencesModel.containsKey(PreferencesModel.SNIPPETS) + + @staticmethod + def getSnippets(): + snippets = PreferencesModel.getValueOrDefault(PreferencesModel.SNIPPETS, PreferencesModel.defaultSnippets()).toPyObject() + # convert QString to python strings + str_snippets = {} + for name, code in snippets.items(): + str_snippets[unicode(name)] = unicode(code) + return str_snippets + + @staticmethod + def setSnippets(value): + PreferencesModel.setValue(PreferencesModel.SNIPPETS, value) + + @staticmethod + def defaultSnippets(): + return defaults.SNIPPETS diff --git a/resources/__init__.py b/resources/__init__.py new file mode 100644 index 0000000..47f94ff --- /dev/null +++ b/resources/__init__.py @@ -0,0 +1,1030 @@ +# -*- coding: utf-8 -*- + +# Resource object code +# +# Created: Thu May 10 18:11:35 2012 +# by: The Resource Compiler for PyQt (Qt v4.7.4) +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore + +qt_resource_data = "\ +\x00\x00\x02\xe6\ +\x3c\ +\x64\x69\x76\x20\x61\x6c\x69\x67\x6e\x3d\x22\x6a\x75\x73\x74\x69\ +\x66\x79\x22\x3e\x0a\x09\x3c\x70\x3e\x54\x68\x69\x73\x20\x70\x72\ +\x6f\x67\x72\x61\x6d\x20\x69\x73\x20\x66\x72\x65\x65\x20\x73\x6f\ +\x66\x74\x77\x61\x72\x65\x3b\x20\x79\x6f\x75\x20\x63\x61\x6e\x20\ +\x72\x65\x64\x69\x73\x74\x72\x69\x62\x75\x74\x65\x20\x69\x74\x20\ +\x61\x6e\x64\x2f\x6f\x72\x0a\x09\x6d\x6f\x64\x69\x66\x79\x20\x69\ +\x74\x20\x75\x6e\x64\x65\x72\x20\x74\x68\x65\x20\x74\x65\x72\x6d\ +\x73\x20\x6f\x66\x20\x74\x68\x65\x20\x47\x4e\x55\x20\x47\x65\x6e\ +\x65\x72\x61\x6c\x20\x50\x75\x62\x6c\x69\x63\x20\x4c\x69\x63\x65\ +\x6e\x73\x65\x0a\x09\x61\x73\x20\x70\x75\x62\x6c\x69\x73\x68\x65\ +\x64\x20\x62\x79\x20\x74\x68\x65\x20\x46\x72\x65\x65\x20\x53\x6f\ +\x66\x74\x77\x61\x72\x65\x20\x46\x6f\x75\x6e\x64\x61\x74\x69\x6f\ +\x6e\x3b\x20\x65\x69\x74\x68\x65\x72\x20\x76\x65\x72\x73\x69\x6f\ +\x6e\x20\x32\x0a\x09\x6f\x66\x20\x74\x68\x65\x20\x4c\x69\x63\x65\ +\x6e\x73\x65\x2c\x20\x6f\x72\x20\x28\x61\x74\x20\x79\x6f\x75\x72\ +\x20\x6f\x70\x74\x69\x6f\x6e\x29\x20\x61\x6e\x79\x20\x6c\x61\x74\ +\x65\x72\x20\x76\x65\x72\x73\x69\x6f\x6e\x2e\x3c\x2f\x70\x3e\x0a\ +\x0a\x09\x3c\x70\x3e\x54\x68\x69\x73\x20\x70\x72\x6f\x67\x72\x61\ +\x6d\x20\x69\x73\x20\x64\x69\x73\x74\x72\x69\x62\x75\x74\x65\x64\ +\x20\x69\x6e\x20\x74\x68\x65\x20\x68\x6f\x70\x65\x20\x74\x68\x61\ +\x74\x20\x69\x74\x20\x77\x69\x6c\x6c\x20\x62\x65\x20\x75\x73\x65\ +\x66\x75\x6c\x2c\x0a\x09\x62\x75\x74\x20\x57\x49\x54\x48\x4f\x55\ +\x54\x20\x41\x4e\x59\x20\x57\x41\x52\x52\x41\x4e\x54\x59\x3b\x20\ +\x77\x69\x74\x68\x6f\x75\x74\x20\x65\x76\x65\x6e\x20\x74\x68\x65\ +\x20\x69\x6d\x70\x6c\x69\x65\x64\x20\x77\x61\x72\x72\x61\x6e\x74\ +\x79\x20\x6f\x66\x0a\x09\x4d\x45\x52\x43\x48\x41\x4e\x54\x41\x42\ +\x49\x4c\x49\x54\x59\x20\x6f\x72\x20\x46\x49\x54\x4e\x45\x53\x53\ +\x20\x46\x4f\x52\x20\x41\x20\x50\x41\x52\x54\x49\x43\x55\x4c\x41\ +\x52\x20\x50\x55\x52\x50\x4f\x53\x45\x2e\x20\x20\x53\x65\x65\x20\ +\x74\x68\x65\x0a\x09\x47\x4e\x55\x20\x47\x65\x6e\x65\x72\x61\x6c\ +\x20\x50\x75\x62\x6c\x69\x63\x20\x4c\x69\x63\x65\x6e\x73\x65\x20\ +\x66\x6f\x72\x20\x6d\x6f\x72\x65\x20\x64\x65\x74\x61\x69\x6c\x73\ +\x2e\x3c\x2f\x70\x3e\x0a\x0a\x09\x3c\x70\x3e\x59\x6f\x75\x20\x73\ +\x68\x6f\x75\x6c\x64\x20\x68\x61\x76\x65\x20\x72\x65\x63\x65\x69\ +\x76\x65\x64\x20\x61\x20\x63\x6f\x70\x79\x20\x6f\x66\x20\x74\x68\ +\x65\x20\x47\x4e\x55\x20\x47\x65\x6e\x65\x72\x61\x6c\x20\x50\x75\ +\x62\x6c\x69\x63\x20\x4c\x69\x63\x65\x6e\x73\x65\x0a\x09\x61\x6c\ +\x6f\x6e\x67\x20\x77\x69\x74\x68\x20\x74\x68\x69\x73\x20\x70\x72\ +\x6f\x67\x72\x61\x6d\x3b\x20\x69\x66\x20\x6e\x6f\x74\x2c\x20\x77\ +\x72\x69\x74\x65\x20\x74\x6f\x20\x74\x68\x65\x20\x46\x72\x65\x65\ +\x20\x53\x6f\x66\x74\x77\x61\x72\x65\x0a\x09\x46\x6f\x75\x6e\x64\ +\x61\x74\x69\x6f\x6e\x2c\x20\x49\x6e\x63\x2e\x2c\x20\x35\x31\x20\ +\x46\x72\x61\x6e\x6b\x6c\x69\x6e\x20\x53\x74\x72\x65\x65\x74\x2c\ +\x20\x46\x69\x66\x74\x68\x20\x46\x6c\x6f\x6f\x72\x2c\x20\x42\x6f\ +\x73\x74\x6f\x6e\x2c\x20\x4d\x41\x20\x20\x30\x32\x31\x31\x30\x2d\ +\x31\x33\x30\x31\x2c\x20\x55\x53\x41\x2e\x3c\x2f\x70\x3e\x0a\x3c\ +\x2f\x64\x69\x76\x3e\ +\x00\x00\x3a\xc6\ +\x89\ +\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ +\x00\x00\x64\x00\x00\x00\x64\x08\x06\x00\x00\x00\x70\xe2\x95\x54\ +\x00\x00\x02\xee\x69\x43\x43\x50\x49\x43\x43\x20\x50\x72\x6f\x66\ +\x69\x6c\x65\x00\x00\x78\x01\x85\x54\xcf\x6b\x13\x41\x14\xfe\x36\ +\x6e\xa9\xd0\x22\x08\x5a\x6b\x0e\xb2\x78\x90\x22\x49\x59\xab\x68\ +\x45\xd4\x36\xfd\x11\x62\x6b\x0c\xdb\x1f\xb6\x45\x90\x64\x33\x49\ +\xd6\x6e\x36\xeb\xee\x26\xb5\xa5\x88\xe4\xe2\xd1\x2a\xde\x45\xed\ +\xa1\x07\xff\x80\x1e\x7a\xf0\x64\x2f\x4a\x85\x5a\x45\x28\xde\xab\ +\x28\x62\xa1\x17\x2d\xf1\xcd\x6e\x4c\xb6\xa5\xea\xc0\xce\x7e\xf3\ +\xde\x37\xef\x7d\x6f\x76\xdf\x00\x0d\x72\xd2\x34\xf5\x80\x04\xe4\ +\x0d\xc7\x52\xa2\x11\x69\x6c\x7c\x42\x6a\xfc\x88\x00\x8e\xa2\x09\ +\x41\x34\x25\x55\xdb\xec\x4e\x24\x06\x41\x83\x73\xf9\x7b\xe7\xd8\ +\x7a\x0f\x81\x5b\x56\xc3\x7b\xfb\x77\xb2\x77\xad\x9a\xd2\xb6\x9a\ +\x07\x84\xfd\x40\xe0\x47\x9a\xd9\x2a\xb0\xef\x17\x71\x0a\x59\x12\ +\x02\x88\x3c\xdf\xa1\x29\xc7\x74\x08\xdf\xe3\xd8\xf2\xec\x8f\x39\ +\x4e\x79\x78\xc1\xb5\x0f\x2b\x3d\xc4\x59\x22\x7c\x40\x35\x2d\xce\ +\x7f\x4d\xb8\x53\xcd\x25\xd3\x40\x83\x48\x38\x94\xf5\x71\x52\x3e\ +\x9c\xd7\x8b\x94\xd7\x1d\x07\x69\x6e\x66\xc6\xc8\x10\xbd\x4f\x90\ +\xa6\xbb\xcc\xee\xab\x62\xa1\x9c\x4e\xf6\x0e\x90\xbd\x9d\xf4\x7e\ +\x4e\xb3\xde\x3e\xc2\x21\xc2\x0b\x19\xad\x3f\x46\xb8\x8d\x9e\xf5\ +\x8c\xd5\x3f\xe2\x61\xe1\xa4\xe6\xc4\x86\x3d\x1c\x18\x35\xf4\xf8\ +\x60\x15\xb7\x1a\xa9\xf8\x35\xc2\x14\x5f\x10\x4d\x27\xa2\x54\x71\ +\xd9\x2e\x0d\xf1\x98\xae\xfd\x56\xf2\x4a\x82\x70\x90\x38\xca\x64\ +\x61\x80\x73\x5a\x48\x4f\xd7\x4c\x6e\xf8\xba\x87\x05\x7d\x26\xd7\ +\x13\xaf\xe2\x77\x56\x51\xe1\x79\x8f\x13\x67\xde\xd4\xdd\xef\x45\ +\xda\x02\xaf\x30\x0e\x1d\x0c\x1a\x0c\x9a\x0d\x48\x50\x10\x45\x04\ +\x61\x98\xb0\x50\x40\x86\x3c\x1a\x31\x34\xb2\x72\x3f\x23\xab\x06\ +\x1b\x93\x7b\x32\x75\x24\x6a\xbb\x74\x62\x44\xb1\x41\x7b\x36\xdc\ +\x3d\xb7\x51\xa4\xdd\x3c\xfe\x28\x22\x71\x94\x43\xb5\x08\x92\xfc\ +\x41\xfe\x2a\xaf\xc9\x4f\xe5\x79\xf9\xcb\x5c\xb0\xd8\x56\xf7\x94\ +\xad\x9b\x9a\xba\xf2\xe0\x3b\xc5\xe5\x99\xb9\x1a\x1e\xd7\xd3\xc8\ +\xe3\x73\x4d\x5e\x7c\x95\xd4\x76\x93\x57\x47\x96\xac\x79\x7a\xbc\ +\x9a\xec\x1a\x3f\xec\x57\x97\x31\xe6\x82\x35\x8f\xc4\x73\xb0\xfb\ +\xf1\x2d\x5f\x95\xcc\x97\x29\x8c\x14\xc5\xe3\x55\xf3\xea\x4b\x84\ +\x75\x5a\x31\x37\xdf\x9f\x6c\x7f\x3b\x3d\xe2\x2e\xcf\x2e\xb5\xd6\ +\x73\xad\x89\x8b\x37\x56\x9b\x97\x67\xfd\x6a\x48\xfb\xee\xaa\xbc\ +\x93\xe6\x55\xf9\x4f\x5e\xf5\xf1\xfc\x67\xcd\xc4\x63\xe2\x29\x31\ +\x26\x76\x8a\xe7\x21\x89\x97\xc5\x2e\xf1\x92\xd8\x4b\xab\x0b\xe2\ +\x60\x6d\xc7\x08\x9d\x95\x86\x29\xd2\x6d\x91\xfa\x24\xd5\x60\x60\ +\x9a\xbc\xf5\x2f\x5d\x3f\x5b\x78\xbd\x46\x7f\x0c\xf5\x51\x94\x19\ +\xcc\xd2\x54\x89\xf7\x7f\xc2\x2a\x64\x34\x9d\xb9\x0e\x6f\xfa\x8f\ +\xdb\xc7\xfc\x17\xe4\xf7\x8a\xe7\x9f\x28\x02\x2f\x6c\xe0\xc8\x99\ +\xba\x6d\x53\x71\xef\x10\xa1\x65\xa5\x6e\x73\xae\x02\x17\xbf\xd1\ +\x7d\xf0\xb6\x6e\x6b\xa3\x7e\x38\xfc\x04\x58\x3c\xab\x16\xad\x52\ +\x35\x9f\x20\xbc\x01\x1c\x76\x87\x7a\x1e\xe8\x29\x98\xd3\x96\x96\ +\xcd\x39\x52\x87\x2c\x9f\x93\xba\xe9\xca\x62\x52\xcc\x50\xdb\x43\ +\x52\x52\xd7\x25\xd7\x65\x4b\x16\xb3\x99\x55\x62\xe9\x76\xd8\x99\ +\xd3\x1d\x6e\x1c\xa1\x39\x42\xf7\xc4\xa7\x4a\x65\x93\xfa\xaf\xf1\ +\x11\xb0\xfd\xb0\x52\xf9\xf9\xac\x52\xd9\x7e\x4e\x1a\xd6\x81\x97\ +\xfa\x6f\xc0\xbc\xfd\x45\xc0\x78\x8b\x89\x00\x00\x00\x09\x70\x48\ +\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\ +\x00\x20\x00\x49\x44\x41\x54\x78\x01\xcd\xdd\x07\xbc\x5e\x75\x7d\ +\x3f\xf0\x73\x47\xf6\x0e\x20\x1b\x13\xc0\x49\x71\xd4\x55\x37\xe2\ +\xa8\x75\xd4\x59\xb5\xad\x75\x50\x6b\x15\xab\xad\xd5\xee\x85\x76\ +\xef\x56\x6d\xad\x5a\x2d\x6a\x6b\xdd\x5b\xfb\x17\x17\x22\x5a\x1c\ +\xb8\x51\x1c\x84\xb0\x91\x04\x08\x49\xc8\xbe\xf7\xf9\x7f\xde\xbf\ +\xe7\xf9\x3e\x79\x72\x73\x03\x09\x04\xed\x37\xaf\x73\xcf\x79\xce\ +\xf9\xcd\xef\xe7\xbb\x7e\xe3\x9c\x8c\xf5\x7a\xbd\xee\xff\x02\x8d\ +\x85\x06\xed\x18\x3b\xe5\x94\x53\xc6\x17\x2c\x58\x30\x31\x39\x39\ +\x39\x91\xdb\x13\x5b\xb6\x6c\x19\xdf\xb6\x6d\xdb\xf8\xc5\x17\x5f\ +\x3c\x7e\xc5\x15\x57\x48\x37\x9e\xa3\xd2\xbb\x1e\x25\x1d\x1a\x1e\ +\x47\x1f\x7d\xf4\xf4\xea\xd5\xab\xa7\xe7\xcf\x9f\x3f\xbd\x70\xe1\ +\xc2\xe9\xf4\x77\x6a\xd7\xae\x5d\x53\xff\xf3\x3f\xff\x33\x9d\x74\ +\x75\x74\xb9\xff\x7f\x82\x11\x63\x3f\xce\x76\x8c\x80\x80\xa9\x13\ +\x8f\x7f\xfc\xe3\x27\x97\x2e\x5d\x3a\x79\xc9\x25\x97\x4c\x9c\x7b\ +\xee\xb9\x13\xee\x0d\x8e\x39\x39\xcf\xcb\x31\x3f\xc7\xc2\x1c\x0b\ +\xee\x78\xc7\x3b\x2e\x38\xf4\xd0\x43\x17\x84\xc9\x13\xe9\xc3\x58\ +\x37\x31\xd1\x8d\x4d\x4f\xf7\x02\xde\xd4\xfa\xf5\xeb\xb7\x7e\xef\ +\x7b\xdf\xdb\x9a\x74\x75\x6c\xcb\xf5\xf6\x1c\x3b\x73\x4c\x39\xee\ +\x7f\xff\xfb\x4f\x1d\x73\xcc\x31\x53\x01\x7a\xe7\x87\x3e\xf4\xa1\ +\x5d\x83\xfb\x0d\xc8\x1f\x27\x38\x3f\x16\x40\x06\x40\x34\x49\x0f\ +\x63\xe6\x1c\x7e\xf8\xe1\xf3\x36\x6c\xd8\x30\x79\xf6\xd9\x67\x03\ +\x06\xf3\x17\xe4\x58\x7e\xfb\xdb\xdf\xfe\x76\xf7\xb9\xcf\x7d\x8e\ +\x3a\xf2\xc8\x23\x8f\x5d\xb1\x62\xc5\xd1\x8b\x16\x2d\x3a\x22\x92\ +\x7e\xe8\xbc\x79\xf3\x96\x4d\x4c\x4c\x2c\x1a\x1f\x1f\x5f\x90\x03\ +\x35\xe9\x9e\x9e\x9e\x0e\x26\xd3\x53\xd3\x53\x53\x5b\x77\xee\xda\ +\x75\xe3\xce\x9d\x3b\x6f\x08\xc3\xd7\x6f\xde\xbc\xf9\xea\xeb\xaf\ +\xbf\xfe\x8a\x2b\xaf\xbc\xf2\xf2\xf3\xcf\x3f\xff\xca\x00\x7e\x4d\ +\xca\xbf\x21\x07\xc0\x76\x3d\xf8\xc1\x0f\x9e\x3a\xe4\x90\x43\x76\ +\x5e\x76\xd9\x65\x3b\xf2\x1c\x68\x4d\x73\x7e\x1c\xc0\xfc\xc8\x00\ +\x99\xa9\x0d\x0f\x7c\xe0\x03\xe7\xad\x5c\xb9\x72\x5e\xa4\x73\x32\ +\x0c\x70\x2c\xc9\x71\xd4\xd3\x9f\xfe\xf4\x3b\x1e\x7f\xfc\xf1\x77\ +\x0d\x83\xee\xb2\x64\xc9\x92\xe3\x63\xba\x8e\xc8\x81\xba\x39\x73\ +\xe6\x44\x11\xa2\x09\xb1\x6e\x0e\x54\x67\xd7\xb4\xdd\x51\xd7\x01\ +\xa7\x9b\x9a\x9a\xea\x02\x4c\xb7\x75\xeb\xd6\x2e\xda\xb3\x25\x00\ +\x5d\xb5\x69\xd3\xa6\x35\xd7\x5e\x7b\xed\x85\x3f\xb8\xf8\x07\xdf\ +\x7e\xcf\x3b\xdf\xf3\xfd\xa4\xbf\x2a\xc7\xa6\x1c\xbb\x7e\xe6\x67\ +\x7e\x66\xd7\xc6\x8d\x1b\xb7\x7d\xee\x73\x9f\xa3\x51\xb4\xe9\x47\ +\xaa\x35\x3f\x12\x40\x06\x60\x90\xfe\xc9\xfb\xdd\xef\x7e\xf3\x16\ +\x2f\x5e\xbc\xe0\x93\x9f\xfc\x24\x10\x98\x20\x20\xdc\xfd\xce\x77\ +\xbe\xf3\xfd\x0e\x3b\xec\xb0\x7b\x02\x21\x66\x8b\x29\xea\xe2\x43\ +\x1a\xc3\xa3\x01\xae\xa7\x73\xf4\xdc\x03\x8a\x23\xf7\x5b\xd1\x05\ +\x0a\x30\x80\x90\xa3\x07\x08\x47\xfc\x85\x63\x2c\xa0\x8c\x0f\x9e\ +\xb5\x7b\xc1\xa6\x0b\xe3\x6f\x0c\x38\x17\xc5\xc4\x7d\xed\xbb\xdf\ +\xfd\xee\x17\xdf\xf9\xce\x77\x7e\x33\xed\x01\xce\xb6\xf8\xb1\x9d\ +\x79\xb6\x35\x1a\xc3\xdc\x01\x86\xd6\x50\x9a\x3e\xe2\xf9\x71\x5b\ +\xd0\x6d\x0a\x48\x01\x71\xe2\x89\x27\x4e\x46\xe2\xf9\x80\x05\x5f\ +\xf8\xc2\x17\xe6\xe6\xbc\xe8\xd8\x63\x8f\xbd\xd3\xd3\x9e\xf6\xb4\ +\x87\xe6\xfc\xd0\xe5\xcb\x97\xdf\x35\x26\x69\x3e\x10\x30\x1a\xe3\ +\x63\x96\xa6\xe6\xce\x9d\x3b\x96\xf3\x58\x34\xa3\x1d\x33\xc0\x18\ +\x6a\xca\x28\x20\x23\xa0\x34\x70\x06\x80\xd0\x92\x9e\x23\x1a\xe2\ +\xe8\xb6\x6f\xdf\x3e\x51\x80\xd1\x9e\x98\xb4\x2d\x31\x9b\x17\x5c\ +\x7a\xe9\xa5\xe7\xbc\xfd\xed\x6f\xff\xec\x0f\x7f\xf8\x43\x9a\xb3\ +\x25\x26\x73\x5b\x80\xdf\x92\x76\xd3\x18\xbe\x46\x60\x70\x9b\x81\ +\x72\x9b\x00\x32\x00\x82\x4d\x99\x88\xa4\xcd\xdb\xb1\x63\xc7\xc2\ +\xcf\x7f\xfe\xf3\xb4\x61\xc9\x4f\xfc\xc4\x4f\x9c\xf4\xc4\x27\x3e\ +\xf1\x31\x01\xe2\xe1\x01\xe1\x98\x65\xcb\x96\x35\x53\x14\xa6\xf7\ +\x62\x96\xa6\x02\xca\x58\xfc\xc4\x38\x30\x98\x28\x07\x20\x66\x03\ +\x23\xe5\xed\x93\x4a\x1b\x4a\x53\x8a\xf9\xcc\x57\xda\x03\x90\x5e\ +\x80\x98\x8e\xa6\x38\x4f\xe4\xde\x98\xfb\xd1\x1a\xe0\x5c\x12\x7f\ +\xf2\xc9\xf7\xbd\xef\x7d\x1f\x8b\xe6\x7c\x27\x95\x6c\x8a\x66\x6f\ +\x4d\x1b\xb6\x0c\x4c\x19\x60\xe0\x72\xd0\x81\x39\xe8\x80\x94\x56\ +\xa4\xc1\x73\x1f\xfe\xf0\x87\x2f\x8c\x69\xe2\xa0\x17\x1f\x75\xd4\ +\x51\x77\x7e\xd6\xb3\x9e\xf5\x84\x84\xa0\x8f\xb9\x5d\x88\x36\x60\ +\x76\xce\x53\x31\x53\xce\xe3\x01\x62\x2c\x40\xb4\xfb\xce\xd1\x8e\ +\x64\x9d\x9d\x4a\xf2\x67\x3e\x65\xde\x94\x5b\x5a\x33\xf3\x39\xa0\ +\x30\x1e\x30\x8e\x00\xd3\x6d\xd9\xba\xa5\xb7\x79\xd3\xe6\xe9\x1b\ +\x6f\xbc\x91\x9f\x01\x4e\xe7\x7a\xdd\xba\x75\x57\x27\x00\xf8\xc8\ +\x1b\xdf\xf8\xc6\x0f\xc7\xe7\xd0\x98\x4d\x11\xb0\x2d\x09\x3e\x6e\ +\xcc\x75\x73\xfe\xc1\x84\x29\x3b\x68\x74\xd0\x00\x19\xd5\x8a\x48\ +\xd3\x82\x48\xd3\xe2\x48\x13\xad\x38\xee\xf4\xd3\x4f\x7f\xec\x49\ +\x27\x9d\xf4\x74\xd1\x12\xe7\x8c\xd9\xf1\x13\x80\x18\x4b\xe4\x64\ +\xcc\xd1\x98\x08\x80\x51\x10\x48\xf5\x75\xd7\x5d\x87\x31\xdd\xd5\ +\x57\x5f\xdd\xc5\x8c\xb4\x23\xcc\xe9\x62\x5e\xba\x44\x4f\x43\x47\ +\x5e\x00\x28\x9b\xd6\xad\x58\xb9\xa2\xbb\xdd\x61\xb7\xeb\x12\xc1\ +\x75\x47\x1c\x71\x44\x3b\x27\x4c\x06\xfc\x90\x79\x04\x9c\xf9\x2a\ +\x70\x80\x90\x32\xa7\x69\x49\x8e\x71\xc0\xf0\x35\xa9\xfb\xe2\x0b\ +\x2e\xb8\xe0\x5d\xaf\x7f\xfd\xeb\xff\x5f\x32\x5f\x9e\xc8\x70\x4b\ +\xda\xb4\xe9\x07\x3f\xf8\x01\xff\x72\x50\xb5\xe5\xa0\x00\x32\xa2\ +\x15\x93\xd1\x8a\xc5\x5f\xf9\xca\x57\x16\x45\xed\x97\xfe\xf4\x4f\ +\xff\xf4\x83\xf2\xfb\x39\xc7\x1d\x77\xdc\xfd\xe2\x27\x30\xbd\x17\ +\x20\x1c\x63\xc0\x28\x20\x9c\x49\x36\x22\xf9\x31\x17\xdd\xd7\xbf\ +\xfe\xf5\x2e\x66\xae\xfb\xd2\x97\xbe\xd4\x45\x22\xdb\xb3\x5b\xf3\ +\xe7\x2e\x77\xb9\x4b\xf7\x93\x3f\xf9\x93\xdd\x03\x1e\xf0\x80\x2e\ +\x7e\xa1\xbb\xc3\x1d\xee\xd0\x69\x53\x51\x69\x4d\x81\x10\x40\x7a\ +\x37\xdc\x70\x83\x83\x29\x1b\x23\x00\x97\x5f\x7e\xf9\xe7\x3e\xfe\ +\xf1\x8f\xbf\xe5\xd3\x9f\xfe\xf4\x17\x02\xf4\xc6\x94\xb9\x29\x6d\ +\xdb\x9c\x32\x4a\x5b\x6e\xb5\x09\xbb\xd5\x80\x0c\xc0\x30\x80\x9b\ +\x1b\x75\x5e\x9a\x06\x12\xc1\x63\x7e\xe3\x37\x7e\xe3\x19\x77\xbd\ +\xeb\x5d\x9f\x99\x91\xf2\x12\xf6\x9f\x46\x84\x01\x13\x39\x37\x29\ +\xa5\x09\x80\x28\xba\xe6\x9a\x6b\xba\x44\x34\x5d\x4c\x5c\xf7\x91\ +\x8f\x7c\xa4\xbb\xf0\xc2\x0b\xeb\x51\x97\x32\x3a\x66\x8d\x29\x2a\ +\xe0\x86\x0f\x5d\x60\x43\x3f\x0a\xde\xe3\x9a\x06\xd0\x32\x4e\xfb\ +\xaa\xab\xae\xce\x79\xcb\x30\xdb\x93\x9f\xfc\xe4\xee\x51\x8f\x7a\ +\x54\xf7\xa0\x07\x3d\xa8\xbb\xd3\x9d\xee\xd4\x7c\x94\x87\x04\xa2\ +\x4c\x19\x0d\x04\x4a\xb4\x94\xd6\x4c\xb8\x7f\xd5\x55\x57\x5d\x1f\ +\x6d\x79\xdb\xbf\xfc\xcb\xbf\xbc\x3b\xc9\xaf\x4c\xf8\xbe\x39\x96\ +\xc0\x98\x86\xd3\xe7\xf0\x6f\x95\x09\xbb\x55\x80\x04\x0c\x62\x3d\ +\x6e\xc4\x7c\xc2\x09\x27\x2c\x4b\x24\xb2\x30\xe6\xe1\x1e\xbf\xf6\ +\x6b\xbf\xf6\xa2\x44\x56\x0f\x61\x3a\xc2\xf4\x5d\x71\xde\x13\x01\ +\x63\x2c\xe1\x6e\x03\x61\x14\x88\x6f\x7f\xfb\xdb\x5d\x24\xae\xfb\ +\xe0\x07\x3f\xd8\x9d\x75\xd6\x59\x29\x4e\x89\xe3\xdd\x49\x91\x68\ +\xe6\xa7\x9c\x32\xdb\x5f\x7c\x2f\xf3\x84\xe1\xdc\xea\x70\xd2\xa5\ +\x9f\x7b\xaf\xbf\xd2\x03\x32\x73\x31\xed\xd9\xf5\x31\x83\x89\xa6\ +\xda\x75\x7c\x5b\x97\xb0\xbb\x7b\xf4\xa3\x1f\xdd\xdd\xf7\xbe\xf7\ +\x1d\x6a\x8d\x7a\xf9\x17\x60\x32\x61\x01\xa5\x01\x23\x00\xa0\x2d\ +\x6b\xd6\xac\xf9\xd4\xdf\xff\xfd\xdf\xbf\x2e\xa0\x7d\xeb\x41\xf7\ +\xba\xd7\xe6\x0b\x2f\xb9\xe4\xfa\x84\xcf\x2d\x44\xbe\x35\xa0\xdc\ +\x62\x40\x06\x60\x4c\x64\x10\xb7\x30\x0c\x5f\x16\xe9\x5e\xfa\x98\ +\xc7\x3c\xe6\xe1\xe9\xd8\x4b\x33\xc2\xbe\x3d\x66\x06\x04\x23\xe0\ +\x09\xc0\xb0\xdd\x80\x10\xd6\xa2\x2f\x7e\xf1\x8b\xdd\x7b\xdf\xfb\ +\xde\xee\xad\x6f\x7d\x6b\x97\x11\x74\xbb\xc7\x8c\xd0\x04\x52\xca\ +\x74\x14\x00\x38\x3e\x67\x10\x69\x49\x08\x08\x84\xd1\x80\xda\xb9\ +\x63\x67\x44\x73\x7a\x9f\x8e\x5c\xda\x3e\x78\xfd\x81\x23\x8d\x2d\ +\xb0\x2f\xba\xe8\xa2\xe6\x27\xa4\x79\xc2\x13\x9e\xd0\x25\x14\xef\ +\x62\x6a\xbb\xb4\xdb\xad\x3d\xb4\x25\x66\xb8\x0b\xd3\xa7\x36\x6c\ +\xb8\x7e\x62\xdb\xb6\xed\x40\xbd\x28\x73\x62\xaf\x8a\x56\x9f\x73\ +\xb7\xbb\xdd\xed\x86\x00\x77\xfd\xda\xb5\x6b\xa9\xe1\xae\x5b\x0a\ +\xca\x2d\x02\x64\x00\xc6\xe4\x3d\xee\x71\x8f\x85\x71\x8a\xcb\x63\ +\x5e\x56\x26\x82\x7a\x4a\xec\xf3\x4b\x12\xce\x2e\x4e\x67\xa7\x39\ +\xd0\x74\x6a\x1c\x83\x01\x51\xce\xfa\xfb\xdf\xff\x7e\x77\xe6\x99\ +\x67\x76\x7f\xf1\x17\x7f\xd1\x3a\x3c\x6f\xfe\xfc\xee\x84\xe3\x4f\ +\xe8\xe6\xcc\x9d\xd3\xed\x88\x44\x92\x4c\xd2\x8c\xd9\x61\x5f\x2c\ +\xd1\x58\x97\xe8\xab\x39\xdf\xef\x7c\x47\x04\xba\x27\x1d\x71\xe4\ +\x11\xcd\x79\x67\xc2\xa4\xdb\xbe\x63\xfb\xec\x26\x2d\x59\x94\x57\ +\x04\x1c\x40\xba\x07\x18\xf5\x91\xfa\xd2\x9a\x47\x3e\xf2\x91\xdd\ +\x4b\x5e\xf2\x92\x66\xd2\x3c\x47\x9c\x3f\x6d\x91\x2e\xa0\x4c\x0b\ +\x34\xa2\x41\x26\x3b\x37\xc4\x64\xbd\x26\x63\x97\x0f\xc6\x2a\x5c\ +\x97\x7e\x32\x69\xfc\xca\x2d\x02\xe5\x80\x01\x19\x80\x31\x71\xf2\ +\xc9\x27\x2f\x8e\x44\x2c\x4f\x58\x78\xe8\x0b\x5f\xf8\xc2\x67\xdf\ +\xeb\x5e\xf7\x3a\x3d\xe6\x4a\xd4\x34\x15\x30\x26\x00\x92\xeb\x76\ +\xe8\xb0\x08\xe6\x5d\xef\x7a\x57\xf7\x87\x7f\xf8\x87\x5d\x3a\xd1\ +\x25\xe2\xea\x32\x75\xd2\x98\x42\x23\x30\x48\xba\xa2\x18\xe3\x6e\ +\x22\xbf\xf9\x8d\x6f\x7c\xe3\x1b\xed\x76\xa6\x35\xba\x7b\xdf\xfb\ +\xde\x4d\x7a\x69\x50\xcc\x46\xf7\xe1\x0f\x7f\x98\xb3\xed\x12\x38\ +\x34\xed\xc2\xb4\xd1\x72\x52\xc1\xd0\xbd\x8c\x82\x52\xd7\xea\xa5\ +\x8a\x93\x73\xfa\x33\x00\xcc\x14\xa1\x41\xbf\xfa\xab\xbf\xda\x80\ +\x89\x2f\x6c\xbf\xf9\x10\xc0\xc4\xaf\x00\xa5\x17\xbf\x37\x1d\x93\ +\x35\x91\xe8\x6f\xe7\x97\xbf\xfc\xe5\xd7\xbe\xe9\x4d\x6f\x7a\x7b\ +\x2c\xc6\xfa\x08\xe0\xb5\xb7\x14\x94\x03\x02\x64\x14\x8c\x34\x7c\ +\x45\x66\x54\x0f\x7f\xd1\x8b\x5e\xf4\xbc\x44\x2d\xa7\x01\x20\xda\ +\x30\x95\x21\xc6\x04\x75\x07\x46\x85\x98\xdf\xfa\xd6\xb7\xba\xbf\ +\xfe\xeb\xbf\xee\xfe\xf3\x3f\xff\xb3\xdd\x5f\xb5\x6a\x55\x03\x00\ +\x33\x48\x2b\xe6\x38\x5c\xa3\x02\x87\x79\xe3\x63\x32\x90\xec\x12\ +\x24\x74\xd1\xc8\x06\x50\x63\x62\xd2\xc9\x13\xc6\x74\x19\xc0\x75\ +\x2f\x7d\xe9\x4b\x5b\x5e\xcc\x03\x7e\x81\x22\x4d\x51\x5d\xcf\x76\ +\x56\xb7\x43\x3e\x26\x0d\xe0\x09\x6b\x9b\x76\xbe\xe1\x0d\x6f\x68\ +\xa6\xac\xcc\x1c\xd0\xf8\x15\x75\x27\x24\x9e\xca\xf5\x04\x8d\x49\ +\x74\x99\xc8\xf8\xf5\x6f\x0d\x28\x3f\x4c\xfe\x6b\x23\x28\x07\xac\ +\x29\xfb\x0d\x48\x3a\xa1\x67\x93\x7c\x46\xa4\x76\x65\x46\xb0\xb7\ +\x0b\x18\xcf\x8f\x23\x3c\x0d\x00\xf1\x13\x53\x09\x05\x1b\x18\x80\ +\x60\x66\xd0\x07\x3e\xf0\x81\xee\x99\xcf\x7c\x66\x1b\x33\x60\x96\ +\x4e\xd3\x08\xc5\x15\x63\xfa\xcc\x90\xba\x6f\x4a\xc6\x13\x2b\x90\ +\x58\x26\xea\x8f\xfe\xe8\x8f\xba\xdf\xfe\xed\xdf\x6e\xa6\xec\xac\ +\x8f\x9d\xd5\x9d\xf3\xd9\x73\xda\xb8\x44\x80\x90\x29\xf8\x8e\x79\ +\xb9\xe7\x3d\xef\xd9\xfd\xef\xff\xfe\x6f\x17\xb3\xd9\x98\x28\x6a\ +\x02\x4a\xf9\x2b\x25\xf7\x71\xe9\x83\x33\x5a\xf7\x1e\xd7\xd1\x25\ +\x66\xb2\x9f\x7e\xac\x99\xd9\xac\xc1\xb4\xb2\x00\xfe\x3b\xbf\xf3\ +\x3b\x6d\x3c\x43\x20\x00\x96\xb9\xae\x06\x4a\x22\xaf\xf8\x95\x0d\ +\x13\x00\x8a\x6f\x7c\x43\x06\x92\x6f\xce\xb8\xeb\x87\x79\x7e\x6d\ +\xcc\xa0\x41\xe4\x7e\x9b\xaf\xfd\x02\x24\x8d\xd6\x13\x66\x68\x41\ +\x7c\xc4\xca\xaf\x7e\xf5\xab\x87\x3e\xff\xf9\xcf\x7f\xee\x4f\xfd\ +\xd4\x4f\xbd\x28\x1a\xd1\x9c\xf7\x28\x18\xfc\x05\xf5\xfe\xb7\x7f\ +\xfb\xb7\xa6\xf2\x3a\x78\xf7\xbb\xdf\xbd\x75\x6c\x94\x01\x80\x40\ +\x7d\x40\xfa\x12\xea\x9a\xcf\xa1\x19\x2f\x7b\xd9\xcb\xba\xbf\xf9\ +\x9b\xbf\xe9\xbe\xf9\xcd\x6f\x76\xa7\x9d\x76\x1a\x09\x6c\xe9\x67\ +\xfe\xf9\xf3\x3f\xff\xf3\xee\xf7\x7e\xef\xf7\xba\x98\x8d\x16\x29\ +\x25\xc8\xe8\x1c\xcc\xcb\x4c\x4d\xe9\x77\x65\xe0\x53\x08\x45\x0a\ +\xab\x36\xed\xf1\x2c\x4d\xcb\x3c\xfe\xd0\xf7\x09\xc3\x13\xb4\x74\ +\x7f\xf7\x77\x7f\xd7\x19\xd3\x20\x9a\x22\x34\xa6\x1d\x40\x49\x24\ +\x36\x21\x7c\x3f\xef\xbc\xf3\x5e\xfd\x96\xb7\xbc\xe5\x6d\x99\x26\ +\x5a\x97\x80\x65\x5d\xee\xb7\x69\xfe\xf4\xad\xdf\xe1\x96\x7b\xf6\ +\x3f\xbb\x8d\xf6\xec\xcf\x35\x56\x9b\xa5\x9b\xb7\x7a\xf5\xea\xe5\ +\x01\x63\xf9\x33\x9e\xf1\x8c\x27\xc7\x67\xbc\x90\x99\x32\xbe\x00\ +\x46\xf9\x0c\x60\x90\x9c\x33\xce\x38\xa3\x81\xc1\xb6\x47\x5a\xba\ +\x8d\xb9\x57\x1d\xd6\x2e\x52\xe6\xa8\xb0\xd6\x99\xe6\x30\x0b\xc0\ +\x60\x9e\x7e\xeb\xb7\x7e\xab\xd9\x73\xd7\xc0\x00\x50\xcc\x64\x97\ +\x48\xa6\x7b\xff\xfb\xdf\xdf\x06\x7a\xea\xfb\x83\x3f\xf8\x83\xee\ +\x8f\xff\xf8\x8f\xdb\x80\xef\xdf\xff\xfd\xdf\xcd\x45\xa5\xae\x7e\ +\xd7\x94\x3b\xb3\x9e\xa9\x41\xbd\x59\x37\xd9\xeb\x59\xb5\x4b\xd4\ +\x06\x4c\x4c\xa7\x0d\xf1\x99\xdd\x47\x3f\xfa\xd1\x66\x3e\xc3\xf0\ +\xc6\x2d\x75\x0b\x5a\x32\x4b\xcd\x27\x0a\xed\xa7\x5c\xc7\xcf\xbd\ +\xe0\x49\x4f\x7a\xd2\xe3\x62\xaa\x97\x47\x8b\x57\xe2\x5d\x0e\xab\ +\x9f\x7d\x15\x6d\xb9\x67\xff\x73\xb3\x80\x24\x9b\x34\x73\xb2\x88\ +\xb3\x34\xa3\xe6\x25\xa7\x9e\x7a\xea\xc3\x72\xfd\xe2\x34\x60\x1c\ +\x18\x71\xe4\x43\x33\x85\x99\x1c\xde\xef\xfe\xee\xef\xb6\x28\x8a\ +\xe9\x20\xed\x99\x2b\xea\x26\xe3\x0f\x00\xb1\x2f\x30\x30\x0e\xd5\ +\x59\x94\x93\x0e\x36\x60\xdb\x83\xfc\xc9\x0a\x5f\x3b\x98\xa7\x4c\ +\x5f\x34\xc0\x30\x2c\x63\xa0\xee\xcf\xfe\xec\xcf\xba\xb3\x33\xa2\ +\x17\xba\x26\x04\xed\x2e\xba\xa8\x6f\xff\x81\xac\xcc\x51\x60\x00\ +\x51\xa0\xd4\xfd\x3d\x41\x23\x2c\xbb\x23\x31\x6d\xe6\x33\x22\xf1\ +\x4d\x20\xd4\xad\x2e\xa4\xcf\x40\x21\x90\x78\x31\xe0\xc9\x9c\x0c\ +\x38\x4f\x4f\xba\x07\x07\xbc\x65\x99\x4a\x32\x25\x60\xe1\xad\xbf\ +\x5e\x20\xe3\x3e\xe8\x26\x01\x09\xa0\x9e\x4f\x44\x1b\x16\x7f\xf6\ +\xb3\x9f\xb5\x80\x74\xb7\x44\x3a\x2f\x09\x63\x96\xc4\x4f\xec\xe1\ +\xc0\x0b\x0c\xa6\xe3\x5f\xff\xf5\x5f\x9b\x5a\xeb\xa4\x31\xc2\xc4\ +\xf8\x44\x93\x44\x1d\x9b\x4a\x78\x3a\xca\xa0\x92\x48\xf7\xd8\x7c\ +\x11\x18\x8a\x39\xec\x12\xa9\x74\x09\x27\xbb\x84\x93\xed\x9e\x3f\ +\xec\xf4\xcf\xff\xfc\xcf\x33\x0b\xcd\x87\xb8\x87\xe9\xe8\xdd\xef\ +\x7e\x77\x0b\x24\x8c\xc2\x11\x81\x2c\x46\xef\x75\x4e\x7d\x75\x6f\ +\xef\xf6\x78\xd6\x7f\x2e\x4d\xbf\xac\xf1\x06\x0a\x6d\x47\x0f\x7b\ +\xd8\xc3\xf6\x00\xc5\x0c\x04\xed\x00\x4a\xfc\xdb\x54\x66\x17\x56\ +\x3c\xf6\xb1\x8f\x3d\x3d\x49\x4f\xca\x80\x79\x69\x84\x04\xff\x8c\ +\x4c\x6f\x52\x4b\xf6\x09\xc8\x40\xbd\xc6\xe3\xc4\x17\xc4\x46\x2e\ +\x4d\x41\x47\x27\x64\x7d\xc1\xaa\x55\xab\x56\x47\x55\xa7\x53\x79\ +\x33\x53\x1c\x38\x30\xd8\x52\xa6\xe3\xb5\xaf\x7d\x6d\xc7\x79\x53\ +\x73\x8c\x1a\x1b\xef\x33\x85\xc4\xf5\xa5\x71\x6f\x46\x14\x43\x34\ +\x55\xd8\x0a\x0c\x81\x42\x85\x9f\x4c\x03\x32\x4e\x31\xc8\xcc\x60\ +\xac\x7b\xe8\x43\x1f\xda\x7c\x86\xfb\xb4\x10\x7d\xf9\x4b\x5f\x6e\ +\xed\xe0\xec\x11\xed\x01\x4a\xbf\xde\xdd\x26\x12\x93\x31\x7c\xcf\ +\xfb\xbb\x05\xa5\xda\xd3\x4f\xd7\xcf\xc7\xd9\x33\x61\x34\xa5\x7c\ +\x08\x50\xb2\xf6\xdf\xea\x12\x9e\x6b\x1b\x50\xe2\x57\xcd\x5c\x4f\ +\xc7\x5c\xdf\x21\x66\xf7\xb4\x24\x38\x26\x13\xa2\xcb\xf3\xdb\xb4\ +\xd2\x4d\x9a\xae\x7d\x02\x92\x8c\x9e\xcd\x8d\x36\x2c\x4d\xa4\xb0\ +\xec\x79\xcf\x7b\xde\xd3\x22\xa9\x0f\x15\x3d\x51\xcf\xf2\x19\x7e\ +\x63\xbc\xb0\x36\xf3\x3b\x5d\x56\xfe\x9a\x33\xd5\x99\x92\xd0\x62\ +\x80\xf3\x6c\x9d\xad\x8e\xf7\x02\x1a\x12\x41\xd1\x16\xe0\x20\x9a\ +\x85\x76\x45\xaa\x81\xc3\x61\xf3\x13\x4c\xc7\x43\x1e\xf2\x90\xe1\ +\xbc\xd7\x0d\x1b\x6f\x68\xe5\x57\xb8\x2d\xb0\x40\xc3\x7a\x1b\x10\ +\x61\x30\x93\x15\x4d\x6d\xf5\x0e\x34\x76\x54\x23\xaa\x3d\xd5\x56\ +\xe6\xcd\x3d\xed\x00\xca\xa6\xcd\x9b\x86\xa0\xfc\xdc\xcf\xfd\x5c\ +\x9b\x08\xd5\xd7\x11\x50\xc6\x00\x43\x50\xe2\x77\x1f\x9e\x28\xf3\ +\x09\xd1\xfc\x15\x19\x77\x2d\x4b\x73\x8c\x34\xf7\x69\xba\x66\x05\ +\x24\x85\xbb\x3f\x91\x91\xf7\xe2\x73\xce\x39\x67\x51\xc6\x19\xf7\ +\x8f\x53\x7b\x06\x46\x0c\xa6\x43\xf8\x8f\xe1\x38\x23\xb1\x77\xb3\ +\xe1\x27\x9e\x78\x87\x16\x5d\x69\x3c\x32\xb8\xd3\x89\x3d\x3b\x3e\ +\x60\x84\x4e\x0e\x99\xd1\x07\xaa\xf2\x31\x4b\x98\xc9\x36\xb7\x72\ +\x06\xe5\x01\xdf\x33\x1a\x94\x8e\x76\x99\xa1\x69\xe6\xab\x25\xca\ +\x1f\x42\x02\x48\x52\x8c\x6a\x3c\xd1\xea\x6f\xf5\x0d\xb4\xd3\x75\ +\x8e\x66\x3e\x47\x4c\x93\xa8\xaa\x6f\x52\xf3\x6c\x90\xa6\xdf\xf6\ +\xe4\x1b\x98\xb8\x06\x4a\xd8\x23\x70\x61\x09\x2c\x0b\x64\xea\xae\ +\xcd\x50\x03\x8b\xb5\xc0\xa7\x00\x32\x9e\xf3\x94\xc1\x6f\x78\xf7\ +\xf4\x1c\xf7\xfe\xda\xd7\xbe\xb6\x24\xbc\xbc\x49\xd3\xb5\x17\x20\ +\x01\xa3\x45\x55\xd1\x86\xf9\x99\xe7\x59\x94\x7e\x1d\x1b\xbf\x61\ +\xd6\x76\x39\xbf\x91\x4e\x8b\x26\x86\x66\xc2\x48\x39\xe3\x91\x36\ +\xf2\x96\xb3\x99\xa9\x5c\x68\x78\xaf\x75\xba\x98\xd0\x3f\xf7\x19\ +\xd1\x37\x17\x18\x50\xbf\x9d\x4b\xa2\xd3\xf0\xb6\xee\x51\xa6\xa1\ +\x18\xac\x4c\x20\x65\x66\xa0\xfb\xa7\x7f\xfa\xa7\xc6\x7c\x53\xf5\ +\x45\x34\x86\xa0\x70\xfa\x48\x5a\xa0\x30\x5d\x8d\xb1\x23\xed\x21\ +\x0c\xa3\x5a\xd1\xcc\xd7\xf0\x5e\x1f\x80\xbe\x86\xec\x16\xa0\x96\ +\x26\x65\x68\x07\x36\x09\x60\x80\x72\xee\xb9\x9f\x6b\xc1\x07\xb3\ +\xad\x3e\x82\x03\x08\x66\x1d\xcf\x32\x81\x79\x48\xe6\xf8\x9e\x9e\ +\x26\x1d\x93\xf1\xdb\x92\x55\xab\x56\xb1\xb1\xb3\x6a\xc9\x5e\x80\ +\x24\x21\x40\x26\x13\xca\x2e\xce\x94\xc0\xd2\x5f\xf8\x85\x5f\x78\ +\x74\xc6\x1e\xf7\x67\x2a\x52\xc9\x18\xf4\xa9\x22\x49\x34\x70\x33\ +\xbd\x80\xd8\x4f\x71\xbf\x86\xce\xec\x7c\x75\x64\x94\xf9\x95\xa6\ +\xce\x3a\xc9\x44\x89\xa4\xd0\xa7\x3e\xf5\xa9\x36\x2d\x9e\xc5\xad\ +\xe1\xe4\x63\x3f\x9c\x1d\xeb\xfe\xe4\x4f\xfe\xa4\xfb\xc5\x5f\xfc\ +\xc5\x36\x43\xcc\x4c\x16\x3d\xee\x71\x8f\x6b\xcc\x78\xee\x73\x9f\ +\xdb\x65\x1d\xa6\x99\x32\x75\x33\x1f\xda\x96\xfd\x71\x43\x8d\x2d\ +\x61\x68\x6d\x1a\xd1\x92\x6a\xcf\xee\xf3\x0c\x5f\x33\x48\xab\xbd\ +\x58\xb5\x69\xe3\xa6\xd6\xce\x37\xbd\xe9\x4d\xdd\x1b\xdf\xf8\xc6\ +\xd6\x14\xa6\xcb\x4c\x05\x3f\x98\x63\x1c\xef\xc2\xc3\x07\x27\x14\ +\x3e\x35\xc2\xb5\x3c\x42\xb3\x38\x09\x45\x5d\x78\xbd\x07\xed\x01\ +\x48\x69\x47\x42\xb6\x05\x99\x30\x83\xe2\x9d\x12\xea\x3d\x89\x29\ +\x48\x21\xbb\x02\xc8\xb8\x8a\x54\x80\x79\xff\xf8\x8f\xff\xd8\x98\ +\x25\xf2\x20\x1d\x54\x76\x77\x47\x06\x66\x61\xa4\xb3\xa3\xc0\xcc\ +\x4c\xe7\x37\x49\xde\x35\xd5\x8f\x98\x7e\xf3\x37\x7f\xb3\x33\x4a\ +\x36\x52\x4f\x67\x5a\xa3\x4d\x91\xc4\x97\xb5\xb0\xda\x94\x79\x84\ +\xa5\x49\xa9\x87\x06\xa1\xd6\x36\x4c\x73\x28\xe7\x3d\xef\x79\x4f\ +\x33\xa3\xa4\x58\xe4\x06\xe8\x89\x89\xfe\x9c\x1a\x66\x8e\xd6\xcf\ +\x77\xf9\x4d\xbb\xb3\x9f\xab\x9d\x47\x9f\xbb\x1e\x02\xd8\xb4\xa8\ +\xdf\x37\xf5\x6a\xaf\x00\x06\x8f\x4c\xef\x84\x6f\x6e\x37\xd3\x45\ +\x5b\x73\x7f\xcc\x2c\x06\x70\x12\x69\x3d\x31\x8f\x4e\xc8\xdc\xdc\ +\x92\xf0\x0c\x7f\xf7\x72\xf0\x7b\x00\x92\x04\x63\x69\xf8\x9c\xd8\ +\x47\xd1\xc0\x8a\x74\xfe\xd1\xf9\xbd\x3a\x76\xb1\x17\x30\x26\x98\ +\x80\x72\x98\xa6\x44\x74\xde\x94\xf9\xa6\x4d\x7d\x30\x74\xb4\x3a\ +\x3b\x64\xfe\x48\x07\x66\x76\x72\xe6\x6f\xda\x75\xdd\xb5\xd7\xb5\ +\x05\xa9\xd4\xdf\x18\x4f\x00\x98\x20\x00\x18\x30\x66\xab\x4e\x77\ +\xe6\x99\x67\x36\x0d\x92\x06\x99\xc2\xa7\xa9\xa2\xaf\xcc\x20\x74\ +\x19\x27\xb5\x29\x9b\x5f\xff\xf5\x5f\xef\x3e\xfe\x89\x4f\x34\x0d\ +\x59\xbb\x76\x6d\xd9\xf6\x36\xdd\x5e\x6d\xc5\xd0\x0a\x1e\xf4\x6d\ +\x49\x02\x0a\x26\x47\xdb\x30\xba\x7c\x47\xdf\xc4\x0d\x84\x6c\xd8\ +\xa7\xfe\xcc\xb4\x65\x5e\x0c\x47\x7f\xf9\x97\x7f\xd9\x02\x0e\xc2\ +\xa9\x1c\xe6\x3d\xa0\x34\x2d\x49\x48\x7c\xe2\x2f\xfd\xd2\x2f\x3d\ +\x32\xc9\x8c\x4b\x4a\x4b\xf6\xc0\x40\x5c\xdc\xa8\xb4\x23\x26\x69\ +\x7e\x96\x4f\xad\x71\xdc\x39\x7e\xe4\xd1\x40\x08\xd2\xd3\x41\x99\ +\x3d\x6c\x5a\xa0\x73\x67\x9c\x71\x46\xe5\x8b\x23\xdc\xd5\x4c\x98\ +\x4e\x14\x20\xa3\xd7\xed\x1e\xb0\x06\xcf\x8b\x19\x33\xcf\x0a\x04\ +\x8a\xa9\x08\xb3\xc1\xa4\x9c\xfa\x9b\x3e\x29\xa6\x5b\x47\xc1\x40\ +\x26\xd3\xf8\x84\x56\x58\x51\x34\x93\x6c\x2d\x03\x01\xf1\xd9\xcf\ +\x7e\x76\xf7\x99\xcf\x7c\xa6\x99\x37\x2b\x91\xa6\xfb\x69\x11\xa2\ +\x71\xe5\x7b\x30\x6c\xe9\xed\x96\x36\xad\xb2\x66\x5f\xa4\x4c\x75\ +\x73\xde\x80\xe1\x1b\xf4\x49\xfb\xc6\xc6\x98\xab\xfe\x12\x81\xf4\ +\x15\x48\x10\x4e\xab\x9d\xc6\x43\xbf\xf2\x2b\xbf\xd2\xf2\x8b\x18\ +\x53\xc7\x58\x8e\xe9\x98\xcd\xf1\xb4\xf9\x51\xc9\xf2\x99\x8c\xb1\ +\x6e\x48\x44\x7a\x63\xa6\x64\x76\xa6\xcc\xe1\xd6\xa2\xe1\x5c\x56\ +\x6e\x8e\xaf\x5a\xb5\x6a\x6e\x18\x7f\x48\x00\x39\x32\xda\x71\x7a\ +\x24\xed\xb9\x41\xb7\x97\xf8\x99\xe6\x34\xb4\x35\x40\xe7\x8c\x39\ +\x38\x5d\x26\x41\x83\x86\x40\x0c\x18\x3f\x13\x90\x7a\x3e\x13\x84\ +\xd1\xdf\xca\x46\x9c\xfb\xe4\xc4\x64\xb7\xf2\x90\x95\x2d\x8a\xb1\ +\xaa\x67\xbe\x2a\x36\xb8\xf9\x2a\x6b\x12\x24\x10\xa3\x4c\xc1\xd3\ +\x18\xe3\x1f\x44\x52\xdd\xc7\xe8\x62\xfa\xc7\x3e\xf6\xb1\x16\x22\ +\x67\x97\x64\xf3\x3d\xd2\x1d\x9b\xfe\xec\x0a\x83\xaf\x1a\x2c\x8e\ +\xb9\x37\x1b\x61\x28\xd3\xb3\x31\xbe\x82\xc9\x53\x2f\x50\x66\x9e\ +\xe5\x65\xca\xb3\x1c\xd1\x69\x2f\x61\x20\x30\xcc\x20\x1e\xe5\x7e\ +\x2f\x26\x78\xcc\x5c\x57\xcc\xda\x99\xff\xf5\x5f\xff\xf5\xba\x0c\ +\xb8\xaf\x8c\xb0\xac\x4b\xd6\xed\xe1\x43\x0b\x4d\x87\x1a\x92\x9b\ +\xa9\x63\x7c\x5e\xc0\x60\xdb\x8e\x5f\xbd\x7a\xf5\xa9\x83\xc6\xf4\ +\x20\x4c\xfd\x90\x89\x3e\x60\xe8\xb0\x29\x11\x0d\x9b\xc9\x7c\xbf\ +\x67\xde\xbb\x69\x40\x94\xdc\x37\x77\xd2\x01\x78\xc7\xce\x1d\x0d\ +\x0c\xa1\xad\x4e\x72\xd4\x19\xa4\xb6\x67\x7f\xfb\xb7\x7f\xdb\x76\ +\x92\xd8\x08\x51\xf3\x4a\x82\x0d\x8c\xb2\x23\x05\x91\xec\x08\x58\ +\x47\x9b\xad\x00\xbe\xe2\x15\xaf\xe8\x04\x08\x96\x02\xd8\xfa\x4f\ +\xc4\x94\x15\xfd\xfe\xef\xff\x7e\x4b\x43\x2b\x84\xad\x02\x00\x75\ +\x8a\x20\xff\xf9\x9f\xff\xb9\xf9\x47\x02\x49\x10\x50\xf5\xb9\x3f\ +\x3a\xe8\xcf\x79\xa9\x9b\xef\xd2\x46\x42\x62\x86\xc1\xda\x0f\xcd\ +\x62\x59\xf0\x30\xc2\xde\xb4\x24\x53\x3d\x0f\x49\x31\x67\x05\x8c\ +\x0d\x11\xf6\xf9\x19\xe7\xd1\x92\x74\xbd\xd7\x6b\xf6\x2b\x3f\x78\ +\x7b\x73\x52\xc0\x58\x14\xd5\xbf\x7f\x22\x93\xb6\x0c\x9b\x42\x2c\ +\x3a\x35\x7b\x98\x67\xcd\x36\x3b\x8b\x5c\x76\xed\xdc\xd5\x34\x03\ +\x13\x0b\x84\x99\xe7\x72\x98\x05\x10\x41\x68\x69\x72\x76\x2d\x6f\ +\xdd\xab\xdf\xfc\x0f\x50\x50\x31\xc1\x14\x7b\x1a\xdf\x7c\x07\xff\ +\xf5\xba\xd7\xbd\x6e\x08\x06\x66\x61\x46\x66\x55\x1b\x03\x30\x0c\ +\x01\x83\xe9\x03\x96\xc8\xcc\xba\x8a\x74\x4c\x0a\x93\x6b\xea\x9e\ +\x80\xbd\xf2\x95\xaf\x6c\x65\x73\xfe\x66\x75\x49\xb1\x70\x36\x6b\ +\xe6\xad\x0e\x8b\x62\x16\xc1\x96\x2f\x5b\x3e\xab\xc3\x1f\xed\xb3\ +\xb6\x23\xed\xab\x99\x06\xa0\xd0\xb2\xe5\x2b\x96\x37\x2d\x0a\x38\ +\xc7\xa7\x2d\xf7\x4d\xb2\x45\x11\x82\x36\x7a\xcf\x75\x8b\xb8\xca\ +\xa1\x8c\x87\xc1\x73\xd2\x10\x80\x1c\x1e\x55\x7b\x50\x80\x60\x8b\ +\xa7\xe3\x43\x86\xda\x21\xea\xf9\x8f\xff\xf8\x8f\x24\xe9\x9b\x95\ +\x06\x44\x31\x78\xa0\x15\xd5\xb8\x21\x48\x7b\x3d\x1f\x68\x42\x8b\ +\x6c\xfa\x40\x36\xd0\x1a\xa8\xf9\x0d\xa0\xfc\xab\x8e\x95\x66\x62\ +\x8a\x6b\xf3\x5b\xc8\xf4\x08\x66\xd3\x54\xcc\xe2\x58\x81\xc8\x44\ +\x68\x03\x19\xc3\x88\x4c\x8b\xb7\xb2\xf8\x0d\x11\x50\xcc\x44\x0b\ +\x0c\x8c\x65\xd8\x7b\x26\x8e\xf6\x18\xd4\x9a\x8e\xa9\x9d\x28\xb4\ +\x05\x20\x26\x14\x09\x80\x69\x92\xcb\xaf\x08\x28\xa9\x8f\x49\x9d\ +\xd6\xfe\x91\xbe\xf5\x05\xab\xd7\xcc\xa5\xba\xb4\xa9\xb4\x90\x2f\ +\x32\x54\x58\xba\x64\xe9\x78\xac\xce\x34\x01\x89\x05\xba\x7f\xba\ +\x71\xc4\x35\x97\x5d\xe3\xb5\x0a\xa3\xf7\x3e\x20\x03\xed\x18\x4b\ +\x82\x79\x51\xd3\x79\xd9\xbb\x74\xd7\x24\xb8\x0b\x7b\x08\x55\x66\ +\x8b\x1a\xa3\xb3\xcf\x3e\xbb\xa9\x23\x49\xd5\xf1\xd6\x88\x41\xc8\ +\xd8\x97\xfa\xd9\x35\xa5\x0f\xdc\xc8\xb3\xa6\x15\x03\xe6\x03\x62\ +\xa0\x29\x3a\xd9\x1c\x7f\xce\x88\xa4\xf7\x95\xb7\x6b\xd3\xf1\x16\ +\x9d\xde\xf1\x8e\x77\xb4\x67\x36\x46\x60\x76\xf9\x13\x69\x0b\x44\ +\x09\xd4\xa9\x8d\x40\x31\xb0\xe4\x4f\x98\x13\x24\x12\x43\x34\xc1\ +\xd4\xcb\x9f\xfe\xe9\x9f\xb6\xc0\x44\x00\x63\x2a\x04\xf3\x91\x05\ +\x29\x13\x95\x4c\x8e\x09\x53\x44\x8b\x58\x0c\x81\x8c\xb6\x36\x60\ +\x46\x4c\x74\x3f\x00\x98\xd3\xd2\xda\xc4\x21\x40\x41\x40\xc1\xcf\ +\x1c\xbd\x05\xf3\x17\x10\x84\x3b\x47\xeb\xef\x7c\xd1\xe5\x17\xcd\ +\x8f\x70\x51\x84\x36\x50\x2c\x0d\x89\x70\x4d\x70\x12\x8b\x93\xe8\ +\x3e\x91\x82\x45\x00\xa1\x1d\xce\x24\x4f\xa7\xac\x41\x20\x9d\x2c\ +\x40\x46\x35\xa2\xdf\xc0\xdd\x91\x56\x03\xa2\x1a\x9b\x73\x03\x10\ +\x18\x33\xee\x15\x10\xad\xf0\x91\x3f\x3a\xc1\xc4\x20\x01\x04\x66\ +\x20\x1d\xc3\x7c\x20\x38\xaa\x0d\xed\xe1\x8c\x3f\xda\x09\x54\xfd\ +\x28\xf3\x27\x7a\x23\x68\x22\x21\xcb\xb4\xe8\xaf\xfe\xea\xaf\x3a\ +\x33\x04\xff\xf0\x0f\xff\xd0\xec\xbf\x10\x5a\x9d\xb6\x26\xf1\x05\ +\x34\xb2\x40\x21\xed\x0d\x90\x26\x58\x03\x13\x3c\xe8\x9f\xb2\x6c\ +\xb6\x30\x52\xa7\x21\x36\xfa\x21\x3c\x93\x2f\x3c\x1d\x9f\x37\x7f\ +\x9e\xe0\x64\x59\xcc\xe2\x3d\xf2\x68\x59\xfa\x88\xf7\xfc\x79\x9b\ +\xb3\x32\x11\x36\x67\xcd\x9a\x35\xd4\xe0\x88\x98\x81\x93\x49\x00\ +\x73\x15\xc9\x68\x7b\x6d\x73\xbf\x6d\x62\xb3\x77\x0a\x33\x74\x12\ +\x13\x86\x0c\x26\xe5\xc5\xe4\xc1\x75\x81\x31\x9a\x66\xef\x6b\x65\ +\x08\x2e\xfa\x1a\xb1\xfb\xac\xc6\x7e\xd4\x62\x74\x8e\xf8\x89\x4c\ +\x3b\xb4\x6b\x1d\xeb\x9b\x8d\x3e\x33\xda\xcd\x7d\xfc\x01\x86\x7a\ +\xf5\x89\x8f\xa1\x25\xb4\x42\x14\x84\xe9\xc8\x00\xd7\xfa\x0b\xff\ +\x21\x9a\xe3\x63\x94\xcf\xb4\x20\xb3\x01\x18\x6b\x93\x05\xb2\x3b\ +\x65\xf1\xe2\xfe\x76\xa5\xe2\x43\xf5\xdf\xf3\xad\x31\x9f\x95\xf7\ +\xac\xb3\x3e\xd6\xcc\x18\xc1\x61\x69\x22\x08\x63\xe1\xeb\x14\x81\ +\xc8\x6c\xc8\x49\x49\x7e\x78\x9c\xfb\xdc\xb8\x09\x6a\xd5\x00\x19\ +\x67\xae\x12\x83\xcf\xcd\xca\xdc\x89\x61\xf8\x2a\x19\x75\x40\xc7\ +\x49\x16\xb2\x99\x0d\xc5\x9c\x0d\xa5\xb6\x1a\x51\xe7\x21\x08\x03\ +\x33\x56\x00\xd4\xf3\x3a\x97\xcf\x00\x43\x78\xb5\x17\x69\x3c\x52\ +\x3f\xca\xab\x6e\x4d\xa2\x49\x30\x52\x2e\xa1\xd8\x1f\x2a\x93\x57\ +\xfd\xb0\x21\x4e\xb9\x00\x41\xa7\x9c\x72\x4a\x5b\xf3\x27\x6c\x59\ +\xbf\x68\x63\x15\x73\x73\x3f\xfb\xb3\x3f\xdb\x7d\x2f\x02\x60\x89\ +\x1a\x7d\x3e\xdb\x5a\xf9\x1b\x81\x01\x52\x86\xf1\xd0\xb0\xcf\x69\ +\x53\x33\xb7\xce\x39\x00\x8a\xde\xf1\x8e\x77\x66\xb1\xec\xa2\x76\ +\x4d\x4b\xf0\x15\x18\xda\x13\x25\x59\x9d\x11\xfb\xaa\x3c\x9c\x7f\ +\xe4\x92\x23\x31\xba\xf5\xdc\x28\x92\x76\x2c\x8c\x0a\xdd\x29\x2a\ +\xb5\xa4\x00\x61\x32\x10\x53\x61\x8b\x27\xd2\x41\xe6\xa2\x1a\x82\ +\xc9\xae\xeb\x77\x3b\x0f\x7c\x42\x45\x58\xf5\xbc\x7f\x8e\x54\xd3\ +\x88\xe4\x19\x2a\x46\x2b\x79\xef\x3f\xe5\xbb\xb2\xe2\xd6\x3a\x98\ +\x85\x9e\x96\x68\xd4\x57\xec\x9d\x6b\xf6\x3b\x05\x32\x67\xad\xcd\ +\x66\x69\x91\x90\xd8\x6f\x4b\xbf\xc8\x34\x50\x85\xbf\xeb\x13\x42\ +\x57\x3e\xfe\x4a\xdf\x6b\x1a\x87\x19\x47\xfd\xfe\x0e\x2c\x44\xfa\ +\xa4\x2c\xe9\x6e\xbc\x71\x73\x8b\xdc\xd4\x93\x65\xef\x96\x16\x3f\ +\x01\x11\x50\xc6\x5d\x07\x98\xe5\x19\x4c\x9e\x98\x87\x8b\x37\x4e\ +\x6f\x84\xc1\x04\x51\x9c\x8c\x2a\xe3\xfc\xf2\x98\xae\x3b\x0c\xd0\ +\x9b\x4e\xc6\x36\xdc\xcf\xfd\x16\xbb\x93\x10\x76\x51\x8c\x8e\x46\ +\x99\xac\x11\x8e\xd6\xb8\xe1\x79\xb7\xb3\x1e\xa6\x6d\x40\xb4\xcc\ +\xad\x8c\x9b\xfb\xa3\x4c\x94\xa9\xeb\xe6\x1c\x8d\xb8\x51\x69\x47\ +\x49\x7f\xbb\xb9\x9f\x7f\x4c\x85\xa0\x62\x34\xc6\xa8\xa7\x24\xba\ +\xe6\xac\x30\x0e\x69\x3b\xaa\xf4\x25\x0c\x75\xbf\xf5\x6d\xd8\xe7\ +\xe2\x43\x16\xd3\xb2\x52\x5a\x02\x45\x1b\x6b\x7a\x46\x7d\x5c\x41\ +\x22\x46\x11\x2c\x0d\x3c\x21\xc5\x2f\x8b\x7f\x9b\x6b\x6f\xc2\x78\ +\xa4\x6f\x32\xa1\x24\x87\x72\x58\xcc\xd5\x71\x1a\x12\x75\xec\x71\ +\x3c\xd5\x28\xbb\x39\xd0\x28\x20\x05\x42\x01\xa1\x61\xa3\xd7\x35\ +\xa6\x68\xf7\x3d\xcb\x41\x63\x66\xb1\x50\xad\xec\xfa\x83\xc9\xca\ +\xa1\xda\xe5\xc4\x57\xad\x5a\xd5\x26\x1a\xa5\x11\x8e\x17\x20\x95\ +\x67\x7f\xce\xc5\xc8\x35\x17\x5f\xdc\x98\xab\x4c\x64\xc5\x8f\xf9\ +\x31\x51\x89\x2e\xfc\xce\x85\x2d\x7a\x33\xb0\x54\x57\xd1\xaa\x55\ +\xb7\x6f\x96\xa1\xc6\x16\xd5\x86\x61\x9f\x07\xa0\x34\x80\x62\x21\ +\xf4\xa3\x40\xa8\xcd\x7c\xca\x2a\xe7\x8e\xc7\x00\xc3\xf3\xdc\x3e\ +\x24\x11\xae\xc5\xc0\xc9\x00\x3f\x0e\x8c\x39\x89\xb7\x8f\x0c\x13\ +\x0e\x93\x41\xbc\x3f\x77\x0e\x0d\xca\xab\xaa\x19\xf6\x1b\x11\x17\ +\x91\xa0\x7e\xa5\x7d\x33\xb5\x37\x10\x33\x81\x61\x9a\x22\xe9\x03\ +\x49\xab\x72\xf6\x75\x2e\xa9\x27\x3d\x88\xb9\xe2\x20\x6b\xfc\xa1\ +\x6d\x15\x79\xa9\xfb\xe6\x08\xc3\x50\x69\xb6\x71\x94\x40\xc1\xf4\ +\x3c\x12\x39\xf2\x1f\x99\xf4\xeb\xb2\x75\xa7\x7b\xca\x53\x9e\xd2\ +\x06\x8a\xff\xfd\xdf\xff\xdd\x34\xb3\xe6\xb7\x1e\xf2\x90\x87\xb6\ +\x99\xed\xbc\x8e\xd0\xf2\x01\x0c\x15\x2f\x76\x2f\xc6\xf5\xfb\x6f\ +\x54\x61\x26\x23\x13\x8a\x2d\xdf\xda\x0c\x52\x11\xfe\x0e\x84\xbe\ +\xbd\x21\x16\x6d\x39\x3c\x81\x06\x47\x85\xe1\x73\xc4\xbe\x00\x99\ +\x17\xdb\x78\x64\x12\x2e\x1d\x64\x68\x89\x73\xbf\x45\x26\x66\x59\ +\x51\x93\x0a\xfc\x6d\xd2\xbe\xdb\x77\xf4\x7f\xef\x06\xa8\x1a\xd9\ +\x3f\x03\xa3\x65\xdf\xaf\x3f\x05\x48\x69\x67\xb6\xfb\x37\x69\x2b\ +\x3b\xec\xb9\x76\x54\xba\xfd\x2a\x34\x89\x0c\x1c\xcb\x41\x1b\x10\ +\x7a\x4f\xe4\xc5\x2f\x7e\x71\xcb\x6e\x83\xdd\xdb\xde\xf6\xb6\x06\ +\x92\x85\x2f\x83\x46\x83\x4e\xab\x93\xc8\xf2\xb4\x91\xbb\x99\x66\ +\x24\xe2\x33\x0c\xc0\xab\xa1\x86\xe0\x49\x3b\xfa\x7c\xd1\x67\x1b\ +\x3c\x68\x1f\x32\x15\x83\x98\xbe\x81\xd0\x8f\xf1\x43\x11\xb0\x65\ +\x29\xef\x88\x3c\x9a\x1f\xa1\x99\xcc\xee\x9c\xe6\x9d\xe6\xc7\x1c\ +\x1d\x9e\xcc\xe3\x7e\x46\x95\x86\x80\xac\x5b\xb7\xbe\x49\xe7\xc4\ +\x64\xe6\x97\x32\x69\x87\x34\x82\x44\xb4\xf1\xc3\xa0\x21\x7b\x0c\ +\xee\xaa\x71\xfb\x61\xa2\x5a\x81\x23\x7f\x74\x6a\x94\xec\xc9\xd2\ +\xf9\x1a\xf5\x96\xe9\x01\xc8\xcc\xb4\xa3\xf9\x66\x5e\x6b\x7b\xf9\ +\x89\x17\xbc\xe0\x05\x1d\xa0\x8d\x3d\x68\x8b\x2d\xae\xd6\x59\x8c\ +\x35\x44\x5d\x06\x73\xd6\x5e\x90\xbd\x60\x2f\x7f\xf9\xcb\xbb\x2c\ +\x65\x77\x67\x9c\x71\x46\xbb\x57\xe3\x19\x7c\x18\x6d\x47\xdb\xcb\ +\x95\x59\xe0\x3e\x30\x7d\x4d\x29\xc1\xa1\x21\xee\xfb\x5d\x5a\xe2\ +\x8c\xe7\x89\xde\x68\xc8\xfc\x68\xfe\xe4\x64\x4c\x92\x70\x61\xc1\ +\xa2\x45\x8b\x0f\x23\x95\x71\x3a\xd3\x39\xc6\x25\x46\xeb\xd7\xf7\ +\x47\x9a\x5e\x0f\x2b\x40\xaa\x42\x7e\x62\x14\x94\xc6\xa0\x02\xc3\ +\xf9\x40\x54\x23\x75\x69\xac\x4e\xf2\x1f\xc6\x0c\xc8\x9e\x2b\xbe\ +\xc4\x28\x1d\x55\x1b\xda\x8f\x03\xfc\x83\xf9\xb4\xc4\x08\x9d\x56\ +\x90\x78\x26\xcc\xf8\xe2\xcd\x6f\x7e\x73\x1b\x04\xda\x88\x87\x4c\ +\xa1\x54\xf8\x2b\x98\xb0\xdf\x0b\x09\xfb\x69\x0e\x49\x6f\x0c\xce\ +\xbd\xd6\x6f\x0f\x19\x83\x7c\xc3\x00\x4f\x4c\xd1\xbb\x5f\x02\x64\ +\xec\xc2\xa7\xc4\x44\x35\x40\xc2\x63\x42\x3f\x1d\xe1\x37\x9d\x72\ +\x58\x72\xcf\x8f\xe6\x4f\x4e\x46\x1a\x00\xb2\x70\xc1\x82\xf9\x2b\ +\x92\x40\xe2\xe1\xbb\xe0\xea\x28\xb5\x05\xd6\xd6\x2d\xd9\x05\x12\ +\xdb\xa8\xa2\xdd\xc7\xc0\x74\x61\xff\x10\x04\xd7\x72\x1f\x18\x95\ +\xb4\x89\xf4\xd8\x6e\x21\x26\x06\x9a\x3e\x47\x89\x42\x86\x40\x01\ +\xee\x40\xa8\xca\x06\x86\x72\x98\x40\x6b\x29\xc2\x5d\xd3\xfa\x96\ +\x7f\xcd\x14\x03\x9c\x9f\x32\x79\xaa\x0e\xa6\xcc\x72\x31\x2a\x30\ +\x81\xd1\xea\xc7\x0b\x0f\x06\x9d\xcd\xcf\xc6\x03\xc8\xf8\xda\x07\ +\x2a\xe7\x5f\xf3\x6d\x00\x91\x7f\xc0\xeb\x76\x8e\x96\x2c\x4f\xd2\ +\x05\x31\xab\x13\x93\x89\xaf\x85\xbe\x0b\xc2\xf0\x25\x65\xdf\x98\ +\x2d\xd7\x88\x54\x21\xf7\x38\x74\xf7\x77\x83\xb1\x1b\x98\xd8\xb0\ +\xe1\x7d\x12\x72\x4b\x08\xd3\x50\xf9\x8f\x53\x4f\x3d\xb5\x31\xc7\ +\x8c\x2c\xd2\x09\x66\x47\x1b\x0e\x14\x10\x6d\xae\x7c\xc0\x06\x8a\ +\xb3\x41\xa7\x01\xa1\x01\x9f\xf5\x0b\x36\xdf\x72\xb4\xc8\x88\x06\ +\x31\x55\x08\x40\xc0\x2c\x2d\x6e\x37\xd3\xcd\xb0\x9e\x91\xea\xff\ +\xd4\xfe\xd4\xe3\x54\xed\x2b\x40\xae\xba\xf2\xaa\x61\xd4\xa5\x1d\ +\x2c\x50\xfa\xd3\x73\x9d\xfe\xda\xf7\x36\x3f\xd6\xaa\xd9\x25\x9c\ +\x9f\x9f\x04\x0b\x3d\xc4\x78\x47\x11\xfb\x5d\xa4\x92\x92\xb4\x02\ +\x45\x03\x5c\x57\x94\x21\xb4\x3d\x50\xaa\x32\x4b\xbd\x95\x87\xf8\ +\x0f\x11\x55\xad\x79\x54\x27\x0f\xb4\xfc\x4a\x2f\xff\x28\x28\x46\ +\xde\xea\xe4\xe4\x1d\xb3\x91\x34\xf2\xd5\x24\xe1\x5e\x69\xd2\xd4\ +\x70\xa0\xdd\xae\x76\xf7\xa6\x83\x48\x4c\x57\xd6\x16\x87\x26\x6b\ +\xcd\xc5\x6b\x86\x80\xe8\xaf\x76\xe4\x18\x1b\xf0\xdc\x14\x3c\x1f\ +\xd2\x42\xde\x06\x48\x1e\xcc\x1f\x24\x6a\x89\xd5\xa0\x21\xa2\x93\ +\xa2\xea\x50\x81\xd1\xce\x79\x38\x6c\x88\xeb\x41\xe3\x2a\xcf\xcd\ +\x9d\xd5\xa9\x5c\x44\x6a\xcc\x95\x15\x30\xf6\x06\x33\x99\x15\x76\ +\x57\x5c\x7f\x73\x65\xde\xd4\xf3\xea\x83\x33\x13\x45\x23\x98\x22\ +\x75\x03\x9f\x06\x1a\x1f\xd0\x52\xe6\x4b\x78\x5b\x21\x73\x09\xce\ +\x5e\xe5\xc3\x83\x72\x10\xc6\x70\xb3\xd7\x96\x78\xfb\xa9\xec\xf3\ +\x42\xca\x2a\xff\xd7\x07\xa4\x7d\xb1\xa2\x09\x78\x34\x45\xc8\xdb\ +\x46\xea\x3c\xb7\xd7\xce\xa2\x14\x13\x29\x32\x3f\xc2\x20\x19\x50\ +\x31\x7e\xf4\xba\xee\xcd\x7e\xde\x7f\xbb\xae\x0e\x07\xc6\xb0\xd9\ +\x80\x70\x4d\x00\xca\xa1\x5b\x0a\xfd\xee\xc0\xc9\x0a\x35\xd9\xe1\ +\x83\x41\xea\x29\x02\x72\x01\xcd\x24\xea\xbf\xdf\x15\x91\x49\xa7\ +\x9d\xd5\xdf\xca\x37\x7a\x6e\x42\x38\x00\x25\x68\xb4\xb4\x63\xce\ +\x4d\x38\xfb\xda\x23\xbd\x32\x8a\xa2\x1c\x43\x5e\xe7\xbe\x99\x92\ +\x36\xb9\xd8\x00\x49\x23\x68\xc9\x10\x88\xca\xe4\x3c\xda\xf8\xd6\ +\x28\xd5\x0c\xcc\x94\xe7\xad\x92\xd4\xd3\xce\x6e\xec\x07\x8d\x82\ +\x01\x08\x12\xc9\x3e\x8f\x52\x5e\x79\x68\x23\xe5\x4f\x67\x7f\x16\ +\x92\xc6\xe2\x90\x90\x53\x9b\x8a\x49\xa3\x02\x24\x9d\x76\x8c\xb6\ +\xd9\xbd\x9b\xa3\x6a\x0f\x7b\x5f\xfd\x50\xae\xeb\x3a\x6e\xae\x0c\ +\xe9\x94\x93\x16\x24\xcf\x80\x1f\xb4\xc6\x8f\x01\x8d\x5e\xf7\xd3\ +\xf6\x1f\xe4\x3e\xfe\xb7\xa3\x1f\xdb\xe6\x57\x3a\x31\xdc\xf0\x30\ +\xc8\xdf\x4e\xa3\x19\x9b\xb3\xae\xca\xaa\xb1\x4d\x0e\x06\x95\xee\ +\xae\x7b\xb4\x88\xbd\xae\x95\x89\x69\x46\xe0\x15\x34\x58\x4e\xb5\ +\x70\xc4\x6f\x88\xb2\x16\x26\xf4\x5d\x9a\xd1\xba\xb7\xaf\x84\xbc\ +\x76\x9d\xa0\x8a\x74\x94\x51\xe5\xcc\xac\x00\x33\x0f\x04\x14\x8c\ +\x1a\x65\x96\xf2\x0e\x24\x7f\xd5\xcf\x8f\xe2\x2a\xdf\xa1\x3c\xe7\ +\x51\x1a\xe5\x65\xd5\x57\xe7\x96\x2d\x7f\x00\xe2\x2b\x39\xad\x00\ +\x8d\x90\xa0\x12\x55\xa7\x15\xda\xbf\x5f\xcf\xf3\x7b\x70\xcf\x45\ +\x72\x0c\xf3\x48\x7b\x53\x54\xcc\xb2\xbe\x5c\x60\xbc\xfa\xd5\xaf\ +\x6e\x6f\x48\x91\x50\x11\x95\xb8\x5f\x9b\xcc\x25\x59\xba\x3d\xf3\ +\xcc\x33\xdb\x16\x1f\x11\x11\x4d\x2a\x50\xd4\xe3\x9a\xc9\xd3\x3e\ +\xed\x15\x21\x31\x79\x55\xcf\x4d\xb5\xe5\xa0\x3f\x4b\x1b\xd2\x88\ +\xc6\x0f\x7c\xb9\x39\x1a\xe1\xb5\x19\xcf\x66\x47\x1b\x20\xb1\xdb\ +\xed\x3b\x84\x12\x14\x28\x0a\xd3\xc1\x0a\x41\xfd\x6e\x93\x83\x2a\ +\x2d\x00\x72\xdd\x0a\xdd\xcf\xc8\x4a\x79\xca\x37\x4f\xd5\xc6\x34\ +\x29\x49\x9c\xef\x7d\x0f\x73\x44\x96\x4c\x6b\x8a\x44\x7d\x45\x36\ +\xe4\x19\x49\x5b\x24\xf2\x59\x0c\xa0\x98\xe8\xe4\x6f\x66\x9a\x3a\ +\x79\x68\x18\x60\x7e\x1c\xa4\x7f\x99\xee\x68\xba\xe1\x5a\x9f\x8b\ +\xf8\xa8\x22\xcf\x08\xa0\x73\x82\x18\x8b\x3b\x8e\x5e\x03\x24\x17\ +\xdb\xf3\x70\x9b\xe8\xa6\x12\xc9\xa8\xb0\x9a\xf1\xc4\xf8\xd2\xc0\ +\x3e\xb2\x2d\x41\x7b\x75\x79\x34\x4c\x96\x6f\x5f\x24\x9f\x68\xc6\ +\xe0\x48\xf4\x62\x73\x01\x30\x4c\x5d\x98\xdc\x2b\x3a\xe3\x15\x67\ +\xc0\xbc\x3b\xe3\x8c\x9c\x43\x96\x5a\xad\x16\xda\xfe\x63\x32\xd0\ +\x98\x81\x06\x88\x7e\x98\x3a\xeb\x17\xda\xad\x1d\x96\x64\x6d\x66\ +\x30\x5b\xdd\x3e\x28\x90\x0e\xef\x8b\xf4\x4f\x9b\x94\xb5\xbf\x7d\ +\xd8\x57\x59\x75\x5f\x79\x76\xce\xd3\x14\xfc\xac\x72\x57\xaf\x5e\ +\x3d\x9c\xd7\x92\x66\x00\x44\x3b\xa7\xed\xd6\xa9\xad\x68\x4d\x0f\ +\x01\x89\x89\xd8\xa2\x80\x3a\x64\x1a\x05\xa4\x0a\x77\x1f\xed\xda\ +\xb5\x73\xb8\xfa\xd5\x6e\xec\xc7\x1f\x79\x99\x17\xd3\x08\xa2\x26\ +\x8c\xf6\xee\x20\x30\x68\x8d\x10\x94\xc4\x3f\xf7\x39\xcf\x6d\x91\ +\x0e\x40\xcc\x96\xba\xef\x65\x4b\xeb\x22\x00\x34\x55\x4e\xb3\x90\ +\x3d\x62\x76\xbd\x03\x87\x04\x5a\xf7\x06\xc8\x8a\xe5\x2b\x86\x8b\ +\x50\xfb\x6a\x5a\x01\x22\x60\x10\x5c\xf8\x7d\x6b\x89\xa0\xb5\xa1\ +\x42\x40\x46\x05\x88\xc9\x4a\xfd\x40\xf8\x40\x80\x1c\xf8\x9a\x70\ +\xd8\xd8\x62\x47\x34\x7b\x7a\x32\xd3\x13\xd3\xd9\x91\x91\xfe\x6c\ +\xdb\x24\x41\x1e\x8e\x49\x04\x41\x85\x99\xbb\x41\x62\x74\x1d\x1e\ +\xa4\x69\x1d\x30\x68\xac\x39\xa6\x96\xe8\x00\xfe\x98\x8e\x30\xe8\ +\x2a\x2d\xb0\x93\xc5\x14\x3b\xb3\x05\x2c\x9d\xca\x37\x53\xba\xd7\ +\xbc\xe6\x35\xc3\x97\x63\xec\x98\xf4\x26\x6c\x01\x22\x2c\x96\x0f\ +\x43\x1d\xa8\x4c\x55\x99\x87\x7d\xf9\x92\xba\x5f\xe6\x0d\xa0\x07\ +\x8b\x08\x57\x4d\xcf\xb3\x08\x48\x9f\x58\x06\x54\xe6\x8a\x9f\xc4\ +\xcf\x84\xd9\xe6\xf2\xb7\x47\x28\xa6\x26\x33\x91\xc7\xa1\x6c\x0b\ +\x63\x37\x60\x7a\x12\xf8\x3e\x6f\x35\xd7\x0d\x00\x00\x17\x72\x49\ +\x44\x41\x54\xe1\x50\xdd\x0a\x10\x92\x2b\x2a\x02\x40\x4d\xb0\x61\ +\x8e\x6d\x32\x2a\x05\xe2\xfe\x48\x98\x34\x98\x66\x3d\xc2\xf2\x66\ +\x6d\xeb\xb1\xc1\x00\x61\xb6\x7d\x50\x1a\x0f\x34\x80\x18\x25\x9b\ +\x70\x64\xb6\x1c\x66\x65\x51\x69\x8f\x6b\x52\xa7\xdc\x9a\xe6\x76\ +\x0f\xcd\xd6\xa6\x02\x83\x1f\x12\x00\x98\xf9\xa5\xa5\x24\x18\x83\ +\x66\xcb\xd3\x2f\x6d\xdf\x7f\x4b\xfb\xad\x0e\x7a\x81\x49\xfb\x09\ +\xd5\x78\x5b\x94\xed\xef\x27\x2e\x0d\x19\x68\x85\xc0\xa5\x7d\xc5\ +\x2e\xe9\x36\xa4\x64\x9f\x12\x9c\x9a\x0c\x9a\x0d\x90\x48\xfb\xb5\ +\x06\x44\x34\x24\x47\x0f\x30\xa4\xce\x1c\x4e\x0d\xca\xca\xc1\x93\ +\x2a\x23\x68\xef\x9e\xff\xf2\x2f\xff\xf2\xbe\x5b\x79\x33\x4f\x8c\ +\xc0\x2d\x80\x61\x2c\x70\xbc\x9c\xbf\x6a\xd5\xaa\xb6\xeb\xdd\xda\ +\xb6\x2d\x9e\x4c\x94\xc5\x22\x36\xf8\xe2\x8b\x2f\x6e\xe3\x10\xd7\ +\x88\x86\x90\x46\x84\x89\x04\xaa\x16\x94\x30\x68\x5f\x54\x0c\xaf\ +\x59\x65\x00\xeb\x47\x49\xf3\xbe\xf2\xdd\xdc\xfd\xf0\xad\x3b\xfb\ +\xec\xb3\x5b\x32\x26\x10\x20\x15\xfa\xea\x57\x99\xaf\x01\x20\x3d\ +\xbc\xc6\x73\xbc\x4f\xa6\xcc\xbd\x4f\xee\x9a\x0c\xe3\x01\xb2\x3d\ +\x52\x78\x4d\x1e\x06\xb4\x9d\x73\xd2\xb1\x06\x88\x92\x99\x15\xaf\ +\x19\x1b\x25\x97\x19\xa8\xce\x92\x26\x4c\x00\x1c\xad\x22\x79\xc8\ +\x73\xd7\xd5\xf1\xba\x47\x55\xeb\x5a\x9e\x4a\x5f\x1b\x0e\xac\xd6\ +\xe9\x08\x7f\xa1\x2e\x1a\x69\x26\x16\x20\x65\x1a\x75\xaa\xea\x67\ +\xae\x08\x89\xdf\xea\x62\x26\x4a\x43\xb4\xad\xea\x6a\x17\xb3\xfc\ +\xa9\x72\xa4\xc5\x3c\x75\x63\x6a\xb5\x6b\x66\x96\xaa\x47\x5d\xd5\ +\xb7\x2a\x43\xbb\xac\xa1\x88\x08\x09\x6c\xb5\xb7\x4c\xa1\x3d\xca\ +\x45\xea\x73\x5f\x5d\xa9\x77\x67\x84\xdb\x4a\x58\x03\x64\x3c\x68\ +\x69\xf9\x8e\x48\xdf\x35\x29\x64\xa3\x44\x01\xa6\x8d\x4d\x14\x60\ +\x74\x7c\xf2\xdd\x4e\x76\x39\x6c\x68\x35\x06\xd3\x30\xc4\x6f\x0c\ +\x26\x61\x0e\xf7\x47\x19\xa7\xd1\x7e\xbb\xef\x90\x16\x99\x71\x65\ +\x2e\x10\x7f\x61\xdb\xa6\x4d\xca\x42\x60\x9b\xd9\x2c\x4a\xd9\x43\ +\x65\xbd\xa2\xc2\x5b\x11\x55\x6d\xa8\xd6\x49\xf5\x15\x53\xf8\xb4\ +\x5a\xea\x25\x20\x37\x47\xc5\x78\x6d\xc2\x44\x34\xda\x8f\xea\x4f\ +\x9d\xa5\x73\xdd\xef\x5b\x5f\xb8\xca\xd7\x12\x58\x5b\x4f\x91\xc8\ +\x94\x70\x30\x89\xd5\x6e\x1a\x82\xca\x5c\x05\x88\xc6\xe3\xf0\xfa\ +\x86\xb5\x6b\xd7\x36\x40\xc2\xcb\x5d\x93\x99\x8a\xd8\x99\xc6\xec\ +\x88\x94\x5e\x13\x1b\xbc\x2e\x12\x7f\x48\x80\x19\x23\xf9\x32\xab\ +\xfc\xde\xf7\xba\x77\x2b\x8c\x79\x29\xdb\xe8\x86\x05\x7f\x5f\x37\ +\xd0\x50\xa8\xeb\x20\xe6\xc8\xe7\x73\x7a\x22\x8b\x2a\xc3\x56\x4e\ +\x26\x4a\x87\x81\xce\xd4\x00\xe3\xa9\x4f\x7d\x6a\x8b\x8a\xf8\x0b\ +\xd2\xcd\x44\x15\x49\xc3\xb7\x58\x4c\xb2\xa9\x8d\x7f\x61\x5e\x2c\ +\x26\x21\xe0\xa0\x02\xa4\x06\x9a\x98\xa6\xfd\xa3\xcf\xda\x8f\xc1\ +\x9f\x4a\xcf\x5c\x20\x51\x9f\xe9\x76\x7d\x2b\x4d\xaf\x34\x83\x2c\ +\xed\x44\xf0\x94\x2b\xda\x63\x36\xf5\x59\x5d\xc8\xb6\x51\xe3\xa4\ +\x32\xef\xee\x95\x49\xd4\x47\xda\x8c\xf0\x83\x76\x10\x7a\x65\x85\ +\xe7\xd7\xa4\xdd\xcd\x64\xe5\x59\x93\xa2\xc5\x79\x71\x84\x97\x7c\ +\x7c\x98\xf2\xf1\x8c\x9a\x7b\x79\x8f\x62\x3a\x9b\xbb\xa6\x65\x42\ +\x61\x7c\x2f\x6b\x05\x8c\x72\x2f\x4c\x6e\xe7\x54\xd6\xce\xee\xcd\ +\x76\x64\x1d\xa1\xe5\x0d\xf3\xdb\x39\x0c\xdd\x2b\x5d\xa6\xd5\x7b\ +\x69\x4c\x2f\x5b\x36\x7b\x09\x0e\xda\x11\x70\x7b\xf1\x1f\xbd\xac\ +\x61\xb7\xf4\xa7\x9d\x76\x5a\x2f\xa6\xac\x5d\x07\xd0\x5e\x7c\x44\ +\x2f\x7b\x99\xda\x6f\x65\xa2\x30\xa6\x9d\xb3\xe3\xb0\xdd\xcf\xe8\ +\xbd\x97\x25\xe7\x76\x3d\x5b\xdb\xdc\x8b\xf0\xb4\xe7\x71\xb4\x37\ +\x99\x6e\x66\xfe\x08\x44\x2f\xd6\xa4\xd5\x17\x86\xb6\x73\x5e\x71\ +\x18\x96\x11\x13\x3f\xbc\x8e\xc0\xb4\xeb\xbc\xbb\xd2\xd2\xf9\x13\ +\x61\xef\x45\x8b\x7b\x59\x6b\x99\xce\x8b\x48\xfa\xec\x33\x7a\x4f\ +\x8d\xb6\xdf\x25\x26\x7a\x19\x78\xa7\xd2\x28\xe2\xb4\x31\x1b\x98\ +\x2f\xa6\x05\x01\x62\x2c\xc8\x4d\x47\x5a\xda\xce\x77\xea\xc6\x6c\ +\x98\xe2\x28\x73\x55\xb6\x31\xf9\x86\x24\x8a\x28\xa9\xa3\x59\xa3\ +\x54\xbf\xa5\x21\xf9\x54\xd9\x57\x1f\x48\x16\xe9\xb7\xc5\xb3\x7c\ +\x4c\x99\x1d\xf9\xbd\x4c\x89\xce\x8e\xb3\xe4\xcb\x7c\xb6\xa3\xb6\ +\xe2\x30\xa7\xa8\xda\x54\x6b\x16\xb4\x70\x2a\xae\x91\xc6\x56\x99\ +\x2d\xe1\xc8\x9f\xba\x5f\x9a\x34\xf2\x68\xaf\x4b\x63\x27\x92\x4d\ +\x7b\x84\xde\xf8\x41\x3b\xd4\xe3\x7c\x66\xa6\x76\x90\x15\x4e\x96\ +\x00\xf1\xbd\xb5\x8d\xc9\xf4\x0f\x52\x27\xeb\x10\xde\xfa\x56\xf0\ +\x58\x78\x4d\xc0\x2e\xc9\xa3\x8d\x31\x57\xdb\x23\x9c\x3b\x79\xe1\ +\xa9\x24\x02\xc8\x96\x0c\xd2\xd6\xc4\x0e\x5f\x87\xa9\x6c\x20\xa6\ +\x2b\x84\x5a\x9e\x7a\xea\xa9\x49\xd2\x5f\xd2\x65\x23\x35\x70\xb0\ +\x69\xb8\xf9\x19\x0e\x11\xa3\xa9\x29\x2a\x26\xcd\x3c\x4b\x23\x2f\ +\xd5\xb6\x3d\xd5\x7b\x80\xee\x99\xc5\x15\x2e\xda\x49\xc8\x14\x99\ +\xa3\x32\xe0\xb3\xd7\x96\x29\x63\xde\x8c\xd4\xed\x00\x41\xda\x30\ +\x0a\x88\x76\x56\x70\x50\xbe\x41\xdd\x0e\xbf\x09\xc4\xe8\xa1\x8c\ +\x02\x0c\x63\xab\xbc\x3a\x2b\xdb\xfb\x20\xfa\xc5\xd7\x01\x83\xe9\ +\xb4\x15\x15\x15\xa0\x06\xa1\x82\x10\x82\xd6\xe6\xd0\x52\x1f\xf2\ +\x1b\x31\xb3\xd6\x75\x90\x7e\x0f\x78\xcb\xfa\xe0\xf1\xb5\x31\xc9\ +\x00\xb1\x61\x00\x06\x53\x34\x64\x3a\x12\xb9\x3d\x12\xba\x2d\x1b\ +\xae\x2f\x4d\xa1\x97\xc6\xe1\xac\x0c\x30\xb4\xa4\x35\x88\xe3\xb6\ +\x3f\xca\x61\x3b\x67\x31\x62\xfb\xb6\xed\x9d\xa3\x48\x23\x2b\xba\ +\x88\x76\xb6\xdb\x75\xae\x34\x1a\x22\x0d\xc7\xac\xa3\xf6\x42\xa5\ +\xde\x26\x79\xc6\x02\x5e\xee\x54\xaf\xb2\x80\xeb\xb0\x37\xd6\x4e\ +\x11\xaf\x1d\xb3\xc5\x6c\xbe\x4e\x02\x12\x61\x3a\xe1\xb1\xdd\x13\ +\x8d\xd6\xe9\x7a\xf4\x77\x4b\x30\xf8\xe3\xbe\xbc\xa4\xd6\x31\x1b\ +\x01\xa8\x22\x37\x33\x0b\xda\x43\xab\xf0\x84\xd0\xb2\x1a\x48\xba\ +\x12\x08\x69\x3c\x43\x96\x87\xab\x9d\x00\x11\x78\xe0\x2d\x1e\x44\ +\x23\x2e\x09\x1f\xae\xc8\xd0\x62\x4b\xda\x6e\x64\x3a\x9c\x3a\xd9\ +\x11\x44\x79\xb8\xf5\xe9\xec\xb7\xe3\x2f\xee\x91\x02\xc7\x92\xb1\ +\x97\x41\x60\x7b\x25\x81\x83\xe6\x9c\x00\x82\x59\xd4\x18\x13\x4a\ +\x1a\xdd\xab\x6b\x0d\xd9\x17\x49\xa3\x33\x80\x61\x62\x94\x6b\xf7\ +\xa0\x68\xca\x20\xd3\x4b\x33\xb4\x47\x3a\x66\xcd\x4b\x9e\xf5\xfe\ +\xb7\xa8\x05\x03\x11\x60\x74\xbc\x48\x79\xb5\x80\xa5\xe3\xc8\x99\ +\xf0\x14\x43\x78\x3b\xdf\x5e\x71\x9f\x34\xcb\xa3\x1e\xc0\xcc\x6c\ +\xbb\xfe\xb0\x0c\x24\x9d\x19\x67\x2a\x2b\x22\xac\xb4\x96\x7d\x45\ +\x83\xda\x25\x4d\x91\x88\xcd\x78\xc8\x58\xea\x01\x0f\x7c\x40\xbb\ +\xad\x4e\xfc\xc2\xd3\xf0\x76\x9c\x45\x48\x7b\x6d\x71\x59\x1f\xdf\ +\xe1\xff\x3b\x21\x11\x0d\x10\xf1\x9b\xff\xa2\xc1\x7c\x8a\x0f\x03\ +\x5f\x90\x01\xdf\x86\x48\xef\x72\x36\x2e\x48\xb6\x0f\x1e\x6b\x9c\ +\xad\x31\xbe\x61\x25\x6c\xd6\x51\x15\xd8\x0a\xd4\x7f\xd7\x2e\xb9\ +\xf7\x93\x4a\x62\x75\x9a\x54\x1b\x18\x92\x18\xfe\xc4\x31\x1b\x1d\ +\x73\x74\x56\x0c\xaf\xb8\x7c\x18\x9e\x1a\x14\x96\x59\x90\x5e\xfe\ +\x92\x64\xe6\x05\xd5\x34\xbd\xce\xcf\x46\x18\x47\x1b\x81\xac\x2d\ +\x45\x05\x3a\x73\x45\xea\x49\xff\x73\x9e\xf3\x9c\x96\xae\xb4\x83\ +\x7f\x60\xaa\x10\x53\x08\x5c\xc4\xfc\x55\xff\x68\xfb\xaa\xdb\xaf\ +\x6a\xf7\xdd\xa3\x35\x82\x18\x3c\x0d\x6f\xd7\x67\x99\xe1\xbb\x79\ +\xb8\x31\x60\x31\x59\x1a\xdd\x7f\xc7\x30\x17\xe6\xb3\xb6\xae\x5e\ +\xbd\xfa\xc6\xa8\xee\x9a\x30\xe9\xc2\x41\xe6\xf6\x45\xe7\xea\x20\ +\xc4\x8d\x17\x10\x0d\x41\xa9\xe7\x16\x93\x4f\xf9\x21\x4c\x51\x9f\ +\x5d\x1f\xf6\x11\x93\x5e\x12\x46\x43\x7c\x98\x0c\x79\x09\x74\x94\ +\x80\x38\xda\x79\x12\x5a\xc1\x00\xa6\x01\x4c\xfe\x55\xab\x56\xb5\ +\xf7\x3f\xbc\xf3\xf7\xaa\x57\xbd\xaa\xbd\x6e\xc0\x09\xd3\x76\xf5\ +\x62\x36\x66\x15\x08\xea\xa8\x6b\x9a\x8c\x38\x72\x26\x92\x94\x0b\ +\xf1\x91\x29\x1f\xeb\x36\xf6\xab\x69\x7b\x11\xad\x55\x2f\x32\xb5\ +\x84\x80\xad\x4d\x11\x8c\x5e\x8e\x31\xe9\x03\xf4\xf7\xa3\x04\x17\ +\x47\xd3\x37\xc7\x24\x53\x06\x6a\xdd\x9b\x4c\x63\x7a\x69\x00\xf1\ +\xd8\x91\x0a\x2d\x22\xac\x4f\x18\x77\x7e\x7c\xca\x7d\xd3\xd8\x71\ +\x88\xc6\xc6\x0d\xdf\xa4\xf2\xca\x97\xf9\x25\x12\x59\x63\x12\x1d\ +\xba\x35\x54\x9d\xc4\x54\x7e\xc5\x08\xbd\x48\x1d\xa8\xd2\x94\x70\ +\x48\x87\x71\x98\x44\x42\xd3\xce\x96\x0e\x43\xe4\xa7\x2d\xc0\x30\ +\xd0\xe4\xfb\x46\x29\x56\x60\xf8\xf2\xcf\xe8\x7d\xd7\xcc\x11\x06\ +\x2a\x9f\xf6\x32\x53\x66\x10\x90\x88\x0a\x48\x16\xd1\xec\x68\x44\ +\x16\xe7\xca\x74\xcb\x57\x20\xbe\xe8\xf4\x17\xb5\xd5\xcf\x96\x66\ +\xa0\x1d\x11\x34\x9f\x2e\x1f\x8f\x85\xd9\x19\x67\xfe\xb5\x3c\x5b\ +\x1f\xcb\x03\x4d\x8e\x38\x0b\x8e\x83\xb7\x70\xfd\xc8\xb1\x2b\x05\ +\xdf\x18\x35\xdd\x98\x17\x63\xbe\x95\xc6\xfc\x00\xd3\xe3\x74\xa0\ +\xda\xa2\x8c\xa4\x69\x5f\xe2\xb1\xf7\x15\xca\x6c\x27\xc2\x90\x5b\ +\x42\x3a\x83\x0a\x50\xcc\x28\xd5\xd7\x79\xcc\x2e\x00\xaa\xb3\xa6\ +\x38\x50\x4d\x7a\xb6\x1f\xf9\x53\xa3\x77\x11\x1a\x30\xbc\xdc\x69\ +\x13\x35\x30\x94\x53\x04\x20\xef\x10\x62\x2a\xe0\x08\x01\x60\xab\ +\x0d\xea\xa1\x79\xce\xc8\x36\x52\xe0\x68\x07\x66\x3b\xbf\xe5\x2d\ +\x6f\x6e\xcf\xf8\xba\x0a\xb5\xa5\x2f\x13\xe7\xe1\xb3\x9e\xfd\xac\ +\xc6\x17\xe5\x0a\x18\x68\x7d\x80\x68\xda\x91\x3c\x6b\xf2\x79\x8d\ +\x6f\xc7\xa4\xde\x10\x4d\x01\x48\x5b\x9c\x92\xaf\x6f\x33\x5c\x45\ +\x65\xa2\x6a\x5b\x13\x3f\xf3\x4e\x97\xe7\xc3\x32\xe7\xa9\x2c\x92\ +\x07\xd1\x5e\x45\x3e\x1a\x2b\xda\x40\x9c\xa8\x4e\x61\xde\xc1\x22\ +\xdf\xea\x45\x15\xa2\x96\xf9\x70\x8f\x99\xc4\x40\x54\xc2\xd0\x7e\ +\xe4\x4f\x31\xc6\x56\x50\x21\x3a\xc6\x1b\x51\x63\x86\xb2\x98\x0c\ +\x1b\xa9\x6b\x26\xc0\x38\xa1\xb4\xaa\xc0\xe0\x27\x11\x00\x94\x27\ +\xcc\xb5\x00\x86\x2a\x4d\x3f\xcc\xed\x4f\x91\xe0\x09\x2a\xed\x05\ +\x08\x62\x66\x7d\xb6\x1c\x01\x2a\xa6\x09\x18\x3e\x55\x3e\xa6\xdc\ +\x68\xc7\x97\xf2\xe8\x8a\x00\x7c\x43\x04\x8c\xf3\xd9\x13\x90\x54\ +\x46\x54\x9b\xd9\x0a\x73\x21\x76\x5d\x22\x9f\xf3\xe3\xb8\xd6\xd0\ +\x84\x14\x32\x0d\x61\x9d\x42\xde\x19\x37\x26\x40\xc3\x08\xa6\xfd\ +\xba\xf5\x7f\xca\xf8\x69\x52\x31\x41\xa9\xae\x09\x03\x12\x50\x8c\ +\x9a\x35\xf7\xd2\x61\xa7\x16\xf7\xf3\x11\xfc\x91\xf6\xca\x83\x21\ +\x56\x27\xcd\x26\x33\x69\x18\x5e\x1a\x55\x80\xd3\x4e\x82\xa5\xdc\ +\x1a\xdc\xf9\x7e\x8a\xf4\x40\x55\x0e\x61\xa8\x17\x3f\x0d\x02\x59\ +\x0e\x60\xd0\x1a\x65\x12\x50\x66\xd2\x47\x0e\x90\x36\x33\x67\xda\ +\x16\x61\xef\x69\x47\x34\xe2\xa2\xcc\x50\x7c\x35\x7d\xb8\x2e\x16\ +\x48\xb4\x31\x34\x57\xf2\x8c\x6a\x08\x5e\xec\x4a\x63\x6e\x8c\xa3\ +\x91\x70\x6d\x9c\xe4\xb9\x1c\x54\x1a\xef\xf3\xa7\x4d\x4b\x4a\xfd\ +\x8d\x19\x4e\x39\xe5\x94\x36\x26\xd0\x38\x54\x9d\x6b\x3f\x6e\x83\ +\x3f\x25\xc1\xe6\xb3\x4a\x1a\x31\x12\xc3\x84\xc7\x36\x44\x73\xdc\ +\xda\xe3\x1e\x13\xe3\xf5\x69\x83\x4f\x1f\x85\x11\x75\x61\xac\x80\ +\xa1\xcc\x6c\x81\x5e\x67\x00\x20\x6f\xde\x96\xef\x51\x07\xb2\xc7\ +\xd8\x37\x55\x04\x14\xca\x75\x1f\x18\xa3\xd1\x1e\x41\x05\x0a\xc2\ +\x2b\xa0\x45\xa0\x7b\xe1\xe1\x38\x5e\xe6\xd5\x8e\xcf\xe7\xd1\x65\ +\x89\xf0\x22\xe3\xd7\x89\xae\x86\xda\x21\xcf\x10\x90\x34\xa8\xb4\ +\x64\x7b\x90\xbb\x21\x95\xac\x8f\x7a\x7e\x31\xe3\x92\xef\x40\x36\ +\x85\x4d\x2b\xb0\x1f\xea\xf6\x9a\x44\xf8\x3a\x02\x22\x51\x6c\xba\ +\xc6\xdd\x96\x54\x8c\xe1\x27\x8a\x71\x84\x80\xe4\x1a\xc7\x18\xe9\ +\x33\x45\x24\x1d\xe3\x4d\x4c\x3e\x27\xe1\x2a\x8d\x61\xef\xf9\x44\ +\x66\x0a\xb0\x25\x58\xda\xab\x5c\xdd\x2f\x29\x37\x36\x32\xd9\x59\ +\xa6\x4e\x7a\x61\xae\xd7\x17\x90\xb4\xa3\xf9\xe5\x03\xb2\x37\x79\ +\xbd\x2c\x8a\x98\x2a\xf5\xe1\x59\xfc\x31\x67\x4e\x83\x2e\x88\xe0\ +\x7c\x25\xda\xb1\x2e\xa6\xaa\xb4\x63\x6a\xc0\xfb\x96\x6f\x08\x48\ +\xfb\x95\xba\x72\xde\x15\x34\x37\xa7\x03\xc2\x96\xb5\x51\xaf\x4f\ +\xa5\xa0\x1d\xb4\x24\x52\x31\x9d\xf3\x90\xf1\xa7\x44\x43\x44\x5c\ +\x08\x63\x46\x25\xa5\xdd\xbc\x8d\xfe\x60\x58\x45\x5f\x18\x03\x1c\ +\x7b\xba\x68\x00\x30\x30\xd0\x7e\x60\x03\x4d\x53\xf9\x34\x06\x63\ +\x30\xc8\x33\x69\x8a\xb4\x1b\xf3\xb4\xbd\x98\x4c\x3b\x7c\x3b\xd2\ +\xef\xf2\x0f\x36\x5e\xdb\x11\x43\x18\x30\x5f\x39\xf2\x29\x7b\x6d\ +\xde\xfd\xa0\x4d\x02\x00\x82\xe0\x3e\xe1\xe4\x2f\x06\x3c\x1b\xcf\ +\x79\x5b\xc0\x38\x27\xf5\x5e\x1a\x33\xbf\x3e\xda\xc1\x01\xb5\xb1\ +\x47\xb5\xc5\x79\x0f\x40\x06\x48\xf1\x25\xdb\x33\x81\x77\x7d\x54\ +\x6f\x7d\x9c\xfb\x97\x73\x7d\x1e\x20\xd2\xa9\x31\x68\xf3\x2b\xd5\ +\x78\xdb\x73\x98\x04\x95\x97\x19\x51\x30\x29\x42\x07\xcb\x8c\x15\ +\xe3\x94\xc9\x64\x54\x78\xa9\x1e\xe0\x00\x85\xcf\xc0\x28\xcb\xbc\ +\xe6\xc1\x7c\xf1\x6e\x75\xa6\xc9\x69\x70\x39\xf7\x51\x30\x94\x55\ +\xed\xd4\x76\xb6\xde\xb7\xb6\x46\xc3\x5c\xda\xe3\x83\x35\x3e\xa8\ +\x86\x80\x8a\x94\x63\xac\x53\xfe\xc6\x14\x0a\x70\x94\xe7\xa0\x89\ +\xf1\x17\xbd\x1c\x63\xfc\x6f\x76\xc3\x9c\x97\xe3\x6b\x19\x42\x5c\ +\x93\x7a\x08\xbb\xa9\x92\x3d\xb4\x43\xb9\x7b\x00\xe2\x46\xa8\x69\ +\x49\xce\x37\x86\xe9\x3c\xe5\x15\x59\x09\x3b\x2b\x52\x70\x65\x0a\ +\x1e\x8b\xea\xf6\xc4\xe7\xc2\x53\x92\x80\x31\x24\xca\xca\x9e\x25\ +\x56\x8d\x42\x9e\xa1\xea\x70\xfb\x71\x2b\xfe\x60\x0c\xa6\x22\x9a\ +\x50\x00\xb9\x5f\x6d\x01\x06\xb2\x70\x55\xe6\xd4\x33\x69\xa4\x2f\ +\x21\x6a\x89\xf2\xa7\x84\x05\x98\x15\x6e\x73\xfc\x4c\x10\x09\xd7\ +\x37\x8c\xaf\xa9\x1b\x82\x50\x91\x95\x34\xfc\x08\xf2\xd9\x27\xfb\ +\xc5\x8a\x08\x2c\x1e\x05\xac\x16\x59\x5d\xb2\xf6\x92\xcb\x32\xcd\ +\xf2\x99\x3c\xbf\x3c\x1a\xb7\x2e\x75\x09\x9c\xf6\xd2\x0e\xf9\xf7\ +\x02\x24\x0c\x04\x88\xc0\x7d\x7b\x0a\xdc\x10\x2d\x59\x97\xeb\xef\ +\xe4\x43\xca\x1f\xcd\xef\x5d\xd1\x84\xf1\x98\xb0\xe9\x20\xdf\x18\ +\x84\xf1\xfc\x87\xaf\x21\x90\xae\x92\x98\x62\xde\xc1\x02\x84\x3d\ +\xe7\xcb\x90\x75\x7e\xa4\x6e\xcc\x36\x6b\x6c\x8e\xad\x6c\xbe\xf0\ +\x98\x44\x9b\xba\xd0\x4e\x92\xac\x1d\xe5\xc8\x5b\xe6\xfc\x29\x40\ +\x44\x8a\xca\xb6\x6d\xd5\x6c\x33\xaa\x76\x7b\x3f\x44\xb8\x8c\x80\ +\x06\x20\xf5\x33\x5b\xc8\x62\x99\x97\x7d\x90\x3c\xc6\x49\xc0\x88\ +\xef\xe5\x73\xfd\xff\x22\xdb\xcf\xfb\xc2\x79\x1f\xcf\xe3\x0b\x13\ +\x2c\xfd\x30\x20\x5e\x97\xeb\x3d\x22\x2b\x79\x8b\xf6\x02\xc4\x83\ +\x14\x5c\xa0\x6c\x8d\x66\xac\x53\x50\x22\xae\xcf\x67\x30\xf3\x69\ +\xb6\x38\x85\x02\xc5\xff\x9f\xd1\xa4\x4e\x72\x52\x49\x92\x4a\x52\ +\x98\x0f\x01\x40\x49\x65\xbf\x48\x85\x57\xd5\x07\x76\xc6\xcc\x0a\ +\x1a\x38\x6e\x54\x65\x32\x4d\x4c\x27\xb3\x4a\xaa\xd5\xcb\x04\xf9\ +\xec\x12\x93\x95\xb6\x0e\x57\x2f\x4b\x8b\xe4\x07\x28\x30\x80\x86\ +\x7c\x4f\x8b\xf9\xab\x70\x99\xa4\x0b\x14\x90\x72\xf4\x05\xb8\xcc\ +\x33\xb2\x7e\x6e\xac\x82\xb4\x85\x10\x2a\x8b\x66\xe0\x11\xfe\xc4\ +\xdc\x9d\x93\xc8\xea\x8b\xf1\xc9\x57\x07\x24\x19\x8d\x6c\xf7\x88\ +\xac\xe4\x2f\x9a\x15\x90\xc1\xc3\x36\x2e\xc9\xf5\xa6\x44\x08\x57\ +\x67\x20\x76\x79\xc2\xbe\xff\x97\xce\x7f\x8b\x4d\x54\x29\x6d\x60\ +\x77\x35\x54\x83\x7c\xe2\xce\x2e\x44\x61\xa9\x1d\x84\x42\xbe\x32\ +\x05\xc5\xbc\x1a\x9d\x57\x03\xf6\xf7\x4c\x13\x10\xa7\x59\x63\x90\ +\x92\x70\x8c\xf0\xa6\xb0\x90\x57\x5b\x68\x88\x7b\xda\x51\x0c\x25\ +\xb5\x06\x93\x24\x1c\xb8\xa5\x2d\xc6\x34\x68\x77\x98\xdb\xdf\x5d\ +\xe9\x1e\x47\x5e\xdb\x94\x98\x63\xe6\xaa\xcc\x54\x6d\x6f\x95\x4e\ +\xdf\x94\x4b\x6b\x08\x2a\xbe\x10\x8e\x0c\x52\xbf\x91\x2f\x60\x7c\ +\x22\xed\xbd\x2c\x3c\x64\xdf\x8c\x6a\xdb\xac\x6e\xf2\xcc\x2a\x9a\ +\x7d\xa3\xab\xd4\x19\x24\x43\x3a\x0c\x94\x6d\x29\xec\xfa\xd8\x4f\ +\x05\xce\xcf\x0e\x90\xf7\xc5\xe6\xae\x48\x87\x8e\xce\xe1\xff\xa7\ +\x6d\x6f\xee\xea\xac\x4e\x62\x02\x9b\xea\x53\x1c\xa6\x27\xbc\xb4\ +\x29\x82\x29\xe9\x9e\x51\xcd\x7e\xff\x2c\x40\xbc\x9e\x6c\x42\x10\ +\xb9\x87\xf1\x34\x00\xd1\x08\x93\x80\x16\x85\xb4\x85\x06\x3c\xe2\ +\x11\x8f\x68\x9f\xff\x33\xdd\x03\x4c\x60\xd1\x20\xc4\xd4\x62\x1e\ +\x80\x8d\xab\xaa\x3c\xe9\x30\xf7\x2b\xe7\x7f\xa5\xcd\x70\x03\x4d\ +\xfb\x39\x6a\xab\x95\x16\xc9\x84\xc5\x48\x1d\x84\x80\x36\x44\x03\ +\xf8\x51\x96\x63\x3c\x02\x79\x59\x96\x94\x3f\x9c\x24\x17\xc5\x6f\ +\x5c\x91\xbc\x4c\xd5\xac\x8e\x5c\x39\x45\xfb\x04\x44\x82\x60\x32\ +\x1d\x50\xa8\xd7\x96\xa8\xe2\xfa\x98\x2e\x9f\xa3\xfb\x66\x36\xb2\ +\xbd\x3b\x8d\x7e\x76\x3a\xb0\x3c\x80\x4c\xe5\xdc\x26\xb3\x98\x12\ +\x9d\x02\x0a\x3b\x6b\xd3\x18\x50\x98\x09\x66\x00\xe9\x58\x49\x76\ +\xbb\x31\xe3\x4f\x3d\x73\xae\x6b\x49\xea\xda\x78\xa2\x66\x07\xd4\ +\x85\xb9\x18\x51\x84\x51\x84\x40\x18\x0a\x2c\xcc\x7d\x4e\xc6\x22\ +\xcc\x1a\x0d\x62\x5a\x6b\x9a\xbe\xc2\x74\x83\x46\x6d\x26\xb4\x80\ +\x74\x66\xf2\x5e\xf1\xca\x57\x34\x66\x8b\xac\x80\xee\x20\x10\x5e\ +\x99\x40\xd2\x15\x18\xca\x0c\x18\xcd\x6f\x64\xc1\xed\xda\x6c\xfe\ +\xf8\x40\x92\x5c\x90\xf6\x5e\x96\x7c\xa6\x7f\xf7\x1a\x04\x2a\x63\ +\x26\xdd\x94\xc9\xaa\xb4\x54\x4b\x44\xb0\x29\x1d\xbf\x3a\x1d\xba\ +\x3c\x36\xf4\x8b\xf9\x8e\xd4\xbb\x33\x6d\xbc\x39\x40\x4d\xc4\xcf\ +\x4c\xe5\xd8\xc3\x7c\x91\x3a\xeb\x27\x6c\xb2\xff\x43\xca\xc0\x0a\ +\xb1\xf1\xcc\x18\x66\x16\x93\xdb\x83\xc1\x1f\x1d\x44\xce\xcc\x80\ +\x4e\xa3\x3a\x8b\xb0\x94\x51\xe9\x38\xe3\x2a\xdb\xba\x3c\x7a\xf9\ +\xcb\x5e\xde\x4c\x0b\x30\x38\x59\x5a\x61\x76\xd6\x84\x23\xc6\x89\ +\x90\x8c\x27\x68\x87\xcf\x96\x7b\xcd\x01\x01\x90\xc4\x13\x1e\xf5\ +\xc9\xa7\x0d\xcc\x1d\x7f\x22\x68\x19\x05\xc3\x33\x9a\xa1\xcc\x80\ +\x20\xd0\x19\x0f\x28\x9b\xf2\x11\xe8\xf7\x87\x47\xe7\x67\xbc\x04\ +\x8c\xab\x52\x74\x45\x55\x6d\x46\xb7\x55\xb6\x8f\x3f\x37\x0b\x48\ +\x1a\x86\x23\xe5\x4f\x6e\x48\xe5\x57\x24\xb4\xbd\x2c\x2a\xf9\xd9\ +\xec\x9b\x7a\x6f\x40\xd9\x1a\xbb\x3a\xa1\x41\xec\xac\x06\x16\x23\ +\x81\x61\xcb\x28\x87\x58\xb6\x17\x23\x85\xc6\x3a\xee\x40\x05\x8c\ +\x73\x49\x2d\xad\x72\xd4\xc0\xac\x00\x51\x96\x30\x95\x24\x23\x1a\ +\x52\xaf\x30\xf0\x67\xca\x3e\xf7\x73\xe7\xb6\x51\x35\xc6\x6a\x03\ +\x8a\x76\xb7\x11\x3b\x3f\xc7\x1c\xd5\x78\xc2\xd7\xe4\x38\x6a\x04\ +\x68\xe5\x6a\x87\xbc\xfa\x63\x33\x38\x50\x69\x5c\x85\xf4\xd2\x02\ +\x0f\x50\xe9\x37\x7f\x39\x9d\x6b\x60\x6c\x06\x46\xee\x9d\x17\xc0\ +\x2f\xc9\x3d\xb6\x94\xdf\x60\x1e\xf6\x1a\x73\xe4\xde\x5e\x74\x93\ +\x26\xab\x52\x03\x25\x8d\x6c\xa1\x70\xee\x6d\x88\x64\x4d\x44\x15\ +\x27\x62\x06\xce\xc6\xa8\xd8\xe9\x27\x87\xb9\x8b\x03\x84\x9d\x2a\ +\xe3\xcc\x12\x29\xd4\x41\x9a\x60\x61\xcb\x48\x5a\x27\x7c\xb1\x8d\ +\xb4\x61\x02\x70\x04\x08\x05\x0c\x20\x01\x87\x89\xd2\x62\x8c\x29\ +\x07\xe4\x37\x32\x1b\x2c\x0f\x20\x00\x63\x10\x58\xa4\x2d\x04\x82\ +\x6f\x30\x50\xf3\x45\x38\xdf\xf2\xad\xbc\xcc\x1d\x5f\x22\x24\x16\ +\x70\x18\xc9\x33\x61\xa2\x26\x00\x11\xbd\x9d\x59\x08\xe3\x2b\x68\ +\x0f\x32\x62\x77\x10\x0e\xa4\x0e\x00\x89\xa6\x2e\xbd\xec\xd2\xde\ +\xda\x8b\xd7\x36\x9f\x11\x30\x36\x26\xfc\xfe\x40\x1c\xf9\xb9\x01\ +\xe3\xe2\x68\x2d\x3b\xba\x5f\x7e\xa3\x15\x3c\xf8\x33\xeb\x6b\x6c\ +\xa3\x09\x46\xaf\xc3\x20\x1a\xa5\x65\xb6\x54\x1c\x92\x0e\x1e\x17\ +\x95\x5c\xb5\xfa\xf8\xd5\x0f\x7a\xd4\x23\x1f\xf5\xe4\xcc\xb0\xae\ +\x38\xf4\xb0\x43\x7b\xc7\x1e\x73\x2c\x69\x1a\x33\xc5\x81\x69\x40\ +\x41\x80\xf2\x4d\x77\x63\x96\xfa\x18\x00\xe6\x91\x4a\x9d\x04\x90\ +\xad\x3e\x00\xd1\x71\x80\xac\x8d\x29\x24\x85\xe5\x8c\xd9\x70\x60\ +\x02\x0f\x93\x00\xc0\x24\xaa\xc3\xe1\xbe\x3a\x4b\x03\xac\xd1\x4b\ +\xa7\x6e\x65\xa8\xc3\xb8\x85\x10\x98\x9e\x67\xba\x68\x83\x36\x10\ +\x14\xe3\x19\x5a\x64\x5e\xca\x88\x5d\x1f\x90\xe8\xd0\x0b\x4b\x04\ +\x84\x66\x04\xb0\x1e\xdf\x15\x30\xc7\xd2\xbe\xf5\x09\x62\x3e\x98\ +\xb6\x7e\x21\x6d\x5b\x13\xa1\x5a\x9b\x2c\x06\xd5\x2d\xc4\x4d\x5f\ +\xfa\xa6\x20\x37\x6e\x8e\x0e\x08\x10\x85\xcd\x00\x65\xe5\x00\x94\ +\xe3\x12\x89\xdc\x27\xb3\xad\x4f\x4a\x94\x73\x0c\xe7\x9e\x86\x4d\ +\x07\x94\x71\xcc\x13\xa5\x60\x0a\x06\x23\x12\x6e\x2f\x96\x71\x0b\ +\xe6\x14\x01\x87\xd9\x99\x49\x05\x06\xa0\x00\x37\x93\x98\x39\x4c\ +\xc5\x64\x8c\xc5\x74\x8e\x1f\x83\x67\x23\xcf\xac\xa7\x63\xec\x4c\ +\x32\x0d\x24\xe2\xb2\xf3\xb2\xda\x4b\x38\x00\x2a\x94\xa5\xc1\x01\ +\x63\x3a\x1a\x60\x9d\x88\xb9\xba\x34\xbb\x1e\x3f\x14\x8d\xfb\x4a\ +\xc0\x5d\x3b\xd0\x0c\x3b\x11\x9b\x13\x3f\x10\x30\xb4\xe5\x80\x01\ +\x69\x99\xf6\xd4\x94\x15\xb1\xcf\x47\x47\x5a\x8e\xcb\xb3\x93\x23\ +\x55\x8f\x8b\x8a\x9f\xcc\x64\xe5\x98\x4e\x23\xc7\x02\xca\xf0\x3f\ +\x38\xc1\xb0\x22\xc0\x7c\x3e\x1f\x46\xb3\xb1\xa1\x3e\x3f\xeb\x99\ +\x29\x0a\x4c\x23\xf1\x98\xca\xbc\x30\x51\x18\x8e\x91\x9e\x61\x92\ +\xe7\xee\x2b\x67\x36\x62\x32\x09\x87\x3a\x1d\x7e\xd3\xa0\x6b\xd6\ +\x5d\xd3\xfe\x57\x83\xca\x63\xa6\xd8\xd2\xb4\xc5\x28\x61\xf3\x28\ +\x01\xd7\xf8\x83\x26\x06\x8c\x5e\x2c\x82\xcd\x6d\xe3\xfc\x50\xcc\ +\xd3\xd7\xf3\x46\xd7\xc7\x92\xfe\x82\xb4\xf9\x92\x98\x31\x76\x4e\ +\x63\x0e\x58\x33\xaa\xce\x5b\x04\x88\xcc\x03\x4d\xc1\x5d\xbb\x1d\ +\x96\x47\x53\x8e\x4c\x63\x4d\x64\xdd\x21\x66\xe2\xe1\xd9\xb9\xf2\ +\xe0\x68\xc8\x3c\xe3\x93\x34\x76\x3a\xa0\x8c\x63\xb4\x31\x44\xf9\ +\x96\xa4\x6d\x44\xba\x6d\x50\x30\x33\xeb\x95\x35\x33\xb5\xa3\x54\ +\x20\x94\x1d\xc7\x24\xe0\x38\x93\xe2\x92\xe4\xba\x2e\xf3\xa5\x0c\ +\x00\x6c\xdd\x96\xff\x32\xf5\x7a\xb3\xdd\xbb\x89\xd6\xd1\x04\x1b\ +\x11\x4c\x44\x12\xa0\x22\x60\x2b\x5f\xbb\x80\xcd\x5f\x04\x8c\xe6\ +\xb8\x69\x49\xb4\x60\x6b\x46\xe0\xe7\x66\x5a\xc5\xfc\xd4\x45\x11\ +\xba\x4b\x72\xcf\x38\x4d\x25\x6d\x05\xf0\x40\x35\xa3\xea\xbe\xc5\ +\x80\x28\x20\x0c\x60\x83\xf8\x94\x79\x39\x96\x24\x24\xbd\x5d\x54\ +\xfb\x98\x38\xc5\xe3\x12\x82\xde\x27\x1f\x77\x79\xc4\xaa\x55\xab\ +\x8e\x35\x26\x89\xa4\x4e\x07\x90\xb1\x74\xbc\x69\x0b\x29\x17\x96\ +\x62\xde\x28\x91\x3c\x63\x17\x4b\xa5\xc6\x31\xa3\x26\x6d\x34\xdd\ +\x2d\xb9\x36\x3e\x39\xe5\x94\x53\xda\xda\x89\xed\x9d\x56\x15\xb5\ +\xa1\x08\x10\x0e\x40\xf0\x15\x9c\x7d\xc0\x30\x63\xdb\x8b\x79\x1a\ +\xf7\x3b\x96\xe0\x92\x68\xf5\xd9\x71\xe2\xe7\xc7\x14\x5f\x1a\x21\ +\xb9\x2c\xcf\x4c\x6c\x99\x68\xab\x81\xdf\x7e\xfb\x8c\xaa\xbb\xce\ +\xb7\x0a\x10\x85\x0c\x40\xa1\x29\x7a\xb6\x28\x8c\x3e\x24\x83\xaa\ +\xa3\x22\x31\x62\xc9\x3b\xc5\x0c\x3c\x24\x83\xae\x7b\x47\x83\x16\ +\xf2\x25\x80\x19\x80\x32\x46\x7b\x00\x53\x1a\xd3\xc7\x37\xb9\x06\ +\x04\x1c\xd1\x4e\x34\xaf\x1d\x29\xb3\x49\x2b\xc6\x90\x54\x63\x10\ +\x5a\x42\x0b\x00\xcb\x2c\xf1\x27\xc6\x40\xfc\x11\xa9\xe7\x94\x53\ +\x77\x3b\xa2\xb1\xed\x4c\x3b\x8a\x00\x80\x68\x04\xf3\xa7\x4c\x65\ +\xc7\x44\xb5\x8d\xdd\xb9\xb6\xf3\x86\x86\x6c\x8e\x89\x3a\x3f\x41\ +\xc9\xe7\x92\xfc\xfb\xd1\xf8\x2b\x92\xf6\x8a\x98\x33\x4e\x8f\xbf\ +\xd8\xef\xd0\x36\x69\xf7\x49\xb7\x1a\x10\x25\x0f\x40\x19\x8d\xc0\ +\x7c\x25\xed\xf0\x74\xea\xc8\x84\x9c\xb9\x3c\xe6\xee\x59\xf4\x7f\ +\x40\x42\xcc\xbb\x44\x4b\xc6\x99\xad\x80\xe1\x7f\x94\x1e\x0b\x40\ +\xed\x7f\xed\x31\x32\xc6\x4c\x4c\xc5\xdc\x99\xe0\xa8\x07\xf3\x31\ +\xad\x0e\x8e\x16\x23\x31\x55\x7a\x47\xf9\x0a\x4c\x57\xde\xa8\x06\ +\x28\xa3\xa8\xf2\x01\x53\xa0\x00\x08\xe6\x29\x00\xf4\x02\xb8\x69\ +\xf3\x71\x5a\x12\xa1\xd8\x15\xad\xf8\x4e\xf6\x8b\x7d\x21\x82\xf1\ +\xad\x94\x7f\x79\xfa\x70\x65\x84\xc3\x8c\xa4\x98\x9c\xbf\x30\x70\ +\xbe\xd9\x41\x5f\xd2\xdc\x2c\x1d\x14\x40\xd4\x32\x00\x85\x09\xa3\ +\x2d\x4c\xd8\xa2\x30\xfd\x90\x30\xe5\xf0\x34\x9e\x81\xbe\x7d\xc6\ +\x05\x77\xcf\x4b\x39\xb4\xe5\x84\x48\x6f\xfb\xaf\xbd\xa3\x35\x3d\ +\x12\xed\xc8\xb5\xff\x41\xa0\x85\xad\x18\x59\xe0\x38\xdf\x5a\x02\ +\x1a\x10\x1c\x05\x2c\x67\x9d\xa0\xc1\x2b\x11\x0d\x8c\x80\x60\x47\ +\x61\x03\x27\xc2\x34\x95\x76\x5f\x94\x49\xcb\xf3\x4d\xa8\xa6\xfe\ +\x4b\xa3\x15\x57\x67\x96\xe1\xea\xa4\x17\x45\x59\xf1\xa3\x15\x6d\ +\xe6\x36\xe5\xf7\x55\x2d\x37\x6e\x0d\x1d\x34\x40\xaa\x11\x03\x60\ +\x70\x90\x6f\x61\x1b\x96\xa6\x23\x5e\x02\x3a\x2c\x9d\x05\xcc\x71\ +\x01\xe6\xa4\x1c\xf7\xc8\xfd\xe3\xe3\x5f\xe6\xd1\x0e\x8e\x3b\x60\ +\xf4\x72\xdd\x03\x4a\x4c\x99\xff\x95\xc1\x57\xa0\x9b\x94\x1b\xb1\ +\x17\x40\xa5\x0d\xce\xb3\x11\xde\xd4\xe1\x7f\xc6\xf1\xbf\xe8\xf8\ +\x9f\x1c\xb6\x6d\xdf\xd6\xb4\x21\x40\xb4\x55\x4f\x5a\x91\x08\xae\ +\xed\x95\x12\xcd\x01\x23\xa0\x6c\x4d\x38\xbc\x26\x20\x7c\x23\xc7\ +\x85\x29\xff\xd2\xb4\xe9\x87\x69\xcb\x35\xb9\xcf\x3c\x89\xa5\x39\ +\x6e\x5a\xb1\x5f\xa3\xef\xa4\xdb\x6f\x3a\xe8\x80\xa8\x79\x86\xb6\ +\xf0\x2d\x0b\xc2\xe4\xa5\x61\xee\xca\x30\xe1\x50\xe0\xe4\xde\x51\ +\x47\x1d\x73\xd4\x89\x27\x9f\x74\xf2\x49\x01\xe6\x84\x68\xc8\x61\ +\x39\xc6\x00\x63\x60\xc7\xdc\xe4\xba\x97\x3c\x3d\xbf\x63\x82\xda\ +\xbb\x2a\x01\xa6\x7d\x0f\x52\xc4\x05\xa0\x02\x47\xbd\x40\x28\x0d\ +\x60\x8a\x98\xb4\x98\xcc\xde\xc0\xc4\xd9\x53\x0b\x90\xec\xea\xbf\ +\x71\x6c\xcb\x96\x1b\xdb\xe0\x91\x96\x04\x94\xe9\x1c\xeb\x62\x87\ +\x2e\xfa\x76\x50\x88\x69\x5a\x93\xe2\xae\x4c\xdd\xeb\x02\x86\x15\ +\xbe\x6b\x03\x16\xa7\x0d\x08\x53\x06\x07\x55\x2b\x52\xde\x90\x6e\ +\x13\x40\xaa\xf4\x01\x30\x7c\x4b\x39\x7d\xc0\xf8\x6f\x5b\x57\x24\ +\x92\x59\x19\x69\x5c\x99\x67\xc0\x39\x3a\xa3\xe6\x13\xe2\x63\x4e\ +\x88\x5f\x39\x3a\x69\x56\x04\x8c\xb9\x05\x0c\xa7\xef\xa0\x25\x39\ +\xb7\x4f\x10\x06\x90\xde\xa8\xc6\xa8\xb3\x00\x01\x46\x0e\xaf\x77\ +\xb7\xd7\x8e\x4d\x9d\x38\x00\x63\x62\x13\x30\x01\x62\x47\x98\x7c\ +\x5d\x7c\xc6\x15\xf1\x11\x17\x27\xb2\x03\x82\x19\xd0\xf5\x31\xb5\ +\xd7\xa6\x9e\x6b\x93\x6e\x43\x04\x68\x26\x10\x07\xc5\x57\x68\xef\ +\x6c\x74\x9b\x02\x52\x15\x8e\x00\xc3\x8c\xcd\xc9\x31\x3f\xfe\xc2\ +\xff\xc0\xb0\x34\x0e\x7c\x79\xec\xf5\xf2\xd8\x75\x8b\x1c\x96\x02\ +\x8f\x48\x54\x76\x74\xa2\xa3\xa3\xe3\xf0\x0f\x0f\x30\x2b\x03\xcc\ +\x92\x68\xc8\x82\x1c\x13\x05\x0c\x0d\xe1\xfc\x47\x03\x80\x02\xa4\ +\x22\x2f\x1a\x02\x84\x80\x6f\x9b\xac\x77\xf1\x37\x05\x88\x60\x70\ +\xed\x35\x09\x65\xaf\x4c\xd4\x04\x00\x21\xeb\x75\x01\x77\x43\xcc\ +\xe7\x86\x68\xd8\x86\x80\x77\x43\x34\x46\xe4\x24\x8c\x2d\x8d\xb8\ +\x4d\x81\x48\x3d\x8d\x7e\x24\x80\x0c\x2b\x63\x5f\xfa\xeb\xf8\xe5\ +\x63\x38\xff\xf9\x31\x0b\x8b\xc2\x78\xe0\x2c\x89\xb9\x58\x92\x7b\ +\x8b\x73\x2c\xcd\x01\xa4\x95\x01\x67\x45\x34\x67\x45\xfc\xca\xb2\ +\x80\xb3\x38\xa0\x2c\x8a\xd3\x9f\x17\x8d\x99\x97\x3c\xbe\x3d\x9c\ +\x64\x43\x0d\x99\x0a\x10\x3b\x72\xc0\x60\x4b\x40\xd8\x1c\xff\x70\ +\x43\xc6\x0a\x1b\xe2\x03\xec\xf6\x70\x18\xc0\xf1\x05\x9b\x32\xa8\ +\xdb\x1c\x10\x36\x06\xa8\x24\xdb\xc4\x51\x03\x81\xb3\x6e\x3e\x22\ +\x67\xce\x3a\x58\x1f\x1c\xa7\x9d\xb2\x6e\x92\x7e\xa4\x80\x54\x4b\ +\x06\x1a\x53\x11\x59\x81\xc3\xd7\xcc\x8f\xb9\x5a\x10\xc6\x2f\x8c\ +\x06\x2c\x0c\x43\x17\x46\x92\x05\x06\x26\x33\x9d\xeb\x00\xa4\xf4\ +\xb4\x4d\xfe\x1a\x5d\x1a\x90\x99\x95\xc6\x4c\x92\xed\xc0\xe0\xe1\ +\x91\xe8\x6e\x6b\xfc\xd3\x96\x98\xb4\x2d\xb1\x46\xed\xc8\x73\x00\ +\x48\x5b\x20\x28\xe7\x47\xa2\x11\xa9\x67\x0f\xfa\xb1\x00\x52\x2d\ +\x18\x01\x66\x54\x73\x30\x18\xa3\xe7\x84\x71\x73\xa3\x3d\x73\x73\ +\x9e\x97\xb4\x73\x63\x8a\xe6\x38\x62\x52\x26\xa3\x01\x13\x91\xea\ +\x89\x30\x16\x18\x43\x40\x02\xe4\x74\x4c\xdb\x74\xf2\x4c\x45\x8b\ +\x76\x45\x81\x76\xe6\xde\xce\x08\xf8\xf6\xf8\x8f\x1d\x01\xa1\x9d\ +\x93\x07\xf3\x39\x67\x07\x10\x81\xf0\x23\xd5\x86\xd4\xb7\x17\xfd\ +\x7f\x6f\x55\xd3\x64\x17\xe9\x5f\xad\x00\x00\x00\x00\x49\x45\x4e\ +\x44\xae\x42\x60\x82\ +" + +qt_resource_name = "\ +\x00\x0a\ +\x0c\x78\x09\xfc\ +\x00\x61\ +\x00\x62\x00\x6f\x00\x75\x00\x74\x00\x2e\x00\x68\x00\x74\x00\x6d\x00\x6c\ +\x00\x0e\ +\x02\x0f\xe3\x87\ +\x00\x69\ +\x00\x63\x00\x6f\x00\x6e\x00\x5f\x00\x61\x00\x62\x00\x6f\x00\x75\x00\x74\x00\x2e\x00\x70\x00\x6e\x00\x67\ +" + +qt_resource_struct = "\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x01\ +\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x02\xea\ +\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +" + +def qInitResources(): + QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/resources/about.html b/resources/about.html new file mode 100644 index 0000000..9015c5f --- /dev/null +++ b/resources/about.html @@ -0,0 +1,15 @@ +
+

This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version.

+ +

This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details.

+ +

You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

+
\ No newline at end of file diff --git a/resources/icon.icns b/resources/icon.icns new file mode 100644 index 0000000..a7406fe Binary files /dev/null and b/resources/icon.icns differ diff --git a/resources/icon.png b/resources/icon.png new file mode 100644 index 0000000..61ad44e Binary files /dev/null and b/resources/icon.png differ diff --git a/resources/icon.pxm b/resources/icon.pxm new file mode 100644 index 0000000..19a0153 Binary files /dev/null and b/resources/icon.pxm differ diff --git a/resources/icon_about.png b/resources/icon_about.png new file mode 100644 index 0000000..8b8b1c6 Binary files /dev/null and b/resources/icon_about.png differ diff --git a/resources/resources.qrc b/resources/resources.qrc new file mode 100644 index 0000000..a6039ca --- /dev/null +++ b/resources/resources.qrc @@ -0,0 +1,7 @@ + + + + icon_about.png + about.html + + diff --git a/tikz_editor.pyw b/tikz_editor.pyw new file mode 100755 index 0000000..c77944a --- /dev/null +++ b/tikz_editor.pyw @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import os +import sys +import atexit # necessary for pyinstaller deployment +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from controllers import ControllerFactory +from tools import isMacintoshComputer +import globals + +__version__ = globals.VERSION +__author__ = globals.AUTHORS +def main(): + app = QApplication(sys.argv) + app.setOrganizationName(globals.ORGANIZATION_NAME) + app.setOrganizationDomain(globals.ORGANIZATION_DOMAIN) + app.setApplicationName(globals.APPLICATION_NAME) + + if isMacintoshComputer(): + # add /opt/local/bin to PATH to find pdflatex binary -- useful for Mac plateform using Macports + os.environ['PATH'] = os.environ.get('PATH', '/usr/bin') + ':/opt/local/bin' + app.setQuitOnLastWindowClosed(False) + + app_controller = ControllerFactory.createAppController() + + args = app.arguments()[1:] + if len(args) > 0: + for file_path in args: + app_controller.open(file_path) + else: + app_controller.new() + + app.exec_() + app_controller.quit() + +main() \ No newline at end of file diff --git a/tools/__init__.py b/tools/__init__.py new file mode 100644 index 0000000..7367586 --- /dev/null +++ b/tools/__init__.py @@ -0,0 +1,49 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import sys +from subprocess import Popen, PIPE +from file import File, FileError +from temp_dir import TemporaryDirectory, TemporaryDirectoryError + +from PyQt4.QtGui import QApplication + +__all__ = ["File", "FileError", "TemporaryDirectory", "TemporaryDirectoryError"] + +def isMacintoshComputer(): + return (sys.platform == 'darwin') + +def isWindowsComputer(): + return (sys.platform in ('win32', 'cygwin')) + +def findCommandLocation(command): + """ + Finds first found location of given command using "which". + """ + try: + p = Popen(["which", command], stdout=PIPE) + ret = p.communicate() + command_path = ret[0].strip() + if command_path == "": + raise Exception() + return command_path + except Exception, e: + return command + +def addToClipboard(text): + """ + Adds the given argument to the system clipboard. + """ + QApplication.clipboard().setText(text) \ No newline at end of file diff --git a/tools/documentIO/__init__.py b/tools/documentIO/__init__.py new file mode 100644 index 0000000..a899237 --- /dev/null +++ b/tools/documentIO/__init__.py @@ -0,0 +1,72 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +# The document IO tools are used for saving TikZ document onto the filesystem. + +from reader import DocumentReader +from template import FileTemplate +from tags import * +from tools import File + +def readPreambleAndSourceFromFilePath(file_path): + reader = DocumentReader(file_path) + return reader.readPreambleAndSource() + +def writeDocumentToFilePath(template, document, file_path): + content = buildFileContentFromDocument(template, document) + File.writeContentToFilePath(content, file_path) + +def buildFileContentFromDocument(template, document): + d = FileTemplate(template, document.preamble, document.source) + return d.buildFileContent() + +def getPreamblePositionFromSourceCode(latex_source): + """ + Returns the position (tuple of line indexes) of the preamble section in the given + LaTeX source. + """ + return getSectionPositionFromSourceCodeAndTags(latex_source, PREAMBLE_BEGIN_TAG, PREAMBLE_END_TAG) + +def getSourcePositionFromSourceCode(latex_source): + """ + Returns the position (tuple of line indexes) of the source section in the given LaTeX + source. + """ + return getSectionPositionFromSourceCodeAndTags(latex_source, SOURCE_BEGIN_TAG, SOURCE_END_TAG) + +def getSectionPositionFromSourceCodeAndTags(latex_source, begin_tag, end_tag): + """ + Returns the position of a section in LaTeX source code. + The position is a tuple of line indexes and the section is identified by the given + begin and end tags. + """ + assert latex_source is not None + assert begin_tag and end_tag + begin_line = 0 + end_line = 0 + i = 1 + lines = latex_source.split("\n") + for line in lines: + if line == begin_tag: + begin_line = i + 1 + elif line == end_tag: + end_line = i - 1 + break + i += 1 + + assert begin_line > 0 and end_line > 0 and begin_line <= end_line + return (begin_line, end_line) + +__all__ = ["readPreambleAndSourceFromFilePath", "writeDocumentToFilePath", "buildFileContentFromDocument"] \ No newline at end of file diff --git a/tools/documentIO/reader.py b/tools/documentIO/reader.py new file mode 100644 index 0000000..28d57ec --- /dev/null +++ b/tools/documentIO/reader.py @@ -0,0 +1,101 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from tools import File +from tags import * + +class DocumentReaderError(Exception): + def __init__(self, message): + super(DocumentReaderError, self).__init__(message) + def __init__(self): + super(DocumentReaderError, self).__init__("Not a valid TikZ document") + +class DocumentReader(object): + """ + The document reader tool extract the preamble and source of a TikZ file. + """ + def __init__(self, file_path): + assert file_path is not None + super(DocumentReader, self).__init__() + self.file_path = file_path + self.file_lines = [] + self.preamble_lines = [] + self.source_lines = [] + self.current_line = "" + self.parsing_preamble = False + self.parsing_source = False + + def readPreambleAndSource(self): + self._checkFileExists() + self._readFileLines() + self._checkDocumentValidity() + self._extractPreambleAndSource() + self._checkParsingValidity() + preamble = "\n".join(self.preamble_lines) + source = "\n".join(self.source_lines) + return (preamble, source) + + def _checkFileExists(self): + if not File.exists(self.file_path): + raise DocumentReaderError("The file does not exist") + + def _readFileLines(self): + content = File.readContentFromFilePath(self.file_path) + self.file_lines = content.split("\n") + + def _checkDocumentValidity(self): + """ + Checks if the document has a TikZ comment tag at the beginning. This allows to + verify if the document was created by this TikZ editor and contains other comment + tags for preamble and source. + """ + if self._isFileEmpty() or self.file_lines[0] != TIKZ_TAG: + raise DocumentReaderError() + + def _isFileEmpty(self): + return len(self.file_lines) == 0 + + def _extractPreambleAndSource(self): + """ + Extracts the preamble and TikZ source from file content using delimiter tags. + """ + for self.current_line in self.file_lines: + if self.parsing_preamble: + self._parsePreamble() + elif self.parsing_source: + self._parseSource() + elif self.current_line == PREAMBLE_BEGIN_TAG: + self.parsing_preamble = True + elif self.current_line == SOURCE_BEGIN_TAG: + self.parsing_source = True + + def _parsePreamble(self): + if self.current_line == PREAMBLE_END_TAG: + self.parsing_preamble = False + else: + self.preamble_lines.append(self.current_line) + + def _parseSource(self): + if self.current_line == SOURCE_END_TAG: + self.parsing_source = False + else: + self.source_lines.append(self.current_line) + + def _checkParsingValidity(self): + """ + Checks if the document parsing is completed (all the begin tags are closed). + """ + if self.parsing_preamble or self.parsing_preamble: + raise DocumentReaderError() diff --git a/tools/documentIO/tags.py b/tools/documentIO/tags.py new file mode 100644 index 0000000..c7c5dd6 --- /dev/null +++ b/tools/documentIO/tags.py @@ -0,0 +1,21 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +# tags used in TikZ files to separate the preamble and source +TIKZ_TAG = "%!tikz editor 1.0" +PREAMBLE_BEGIN_TAG = "%!tikz preamble begin" +PREAMBLE_END_TAG = "%!tikz preamble end" +SOURCE_BEGIN_TAG = "%!tikz source begin" +SOURCE_END_TAG = "%!tikz source end" \ No newline at end of file diff --git a/tools/documentIO/template.py b/tools/documentIO/template.py new file mode 100644 index 0000000..0924f2e --- /dev/null +++ b/tools/documentIO/template.py @@ -0,0 +1,51 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from string import Template + +from tags import * + +class FileTemplate(object): + """ + The file template tool generates a full LaTeX/TikZ source from a template, preamble + and source. + """ + def __init__(self, template, preamble, source): + assert preamble is not None and source is not None + super(FileTemplate, self).__init__() + self.content = "" + self.preamble = preamble + self.source = source + self.latex_template = Template(template) + + def buildFileContent(self): + """ + Builds the TikZ document with given preamble and source and the document template. + """ + self._buildPreambleChunk() + self._buildSourceChunk() + self._buildContentFromTemplate() + return self.content + + def _buildPreambleChunk(self): + self.preamble = "%s\n%s\n%s\n" % (PREAMBLE_BEGIN_TAG, self.preamble, PREAMBLE_END_TAG) + + def _buildSourceChunk(self): + self.source = "%s\n%s\n%s\n" % (SOURCE_BEGIN_TAG, self.source, SOURCE_END_TAG) + + def _buildContentFromTemplate(self): + self.content = TIKZ_TAG + "\n" + self.content += self.latex_template.safe_substitute(PREAMBLE=self.preamble, SOURCE=self.source) + \ No newline at end of file diff --git a/tools/file.py b/tools/file.py new file mode 100644 index 0000000..6b59b4b --- /dev/null +++ b/tools/file.py @@ -0,0 +1,118 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import os + +import models.preferences + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +class FileError(Exception): pass + +class File(object): + """ + The file tool is a wrapper to QT's file IO functions. + """ + + LAST_OPENED_PATH = os.getenv("HOME") + + @staticmethod + def getFileNameFromFilePath(file_path): + file_info = QFileInfo(file_path) + return unicode(file_info.fileName()) + + @staticmethod + def getDirectoryFromFilePath(file_path): + file_info = QFileInfo(file_path) + return unicode(file_info.path()) + + @staticmethod + def showOpenFileDialog(default_directory=None): + if default_directory is None: + default_directory = File.LAST_OPENED_PATH + file_path = QFileDialog.getOpenFileName(None, "Open File", default_directory) + if not file_path.isEmpty(): + File.LAST_OPENED_PATH = File.getDirectoryFromFilePath(file_path) + return unicode(file_path) + + @staticmethod + def showSaveFileDialog(parent=None, file_name=None): + file_path = QFileDialog.getSaveFileName(parent, "Save File As", file_name) + return unicode(file_path) + + @staticmethod + def readContentFromFilePath(file_path): + f = File(file_path) + return unicode(f.readContent()) + + @staticmethod + def writeContentToFilePath(content, file_path): + f = File(file_path) + f.writeContent(content) + + @staticmethod + def exists(file_path): + return QFile.exists(file_path) + + def __init__(self, file_path): + assert file_path is not None + self._file_path = file_path + self._file_descriptor = None + + encoding = models.preferences.PreferencesModel.getFileEncoding() + if encoding == models.preferences.PreferencesModel.ENCODING_LATIN1: + self._codec = "ISO 8859-1" + else: + self._codec = "UTF-8" + + def readContent(self): + self._openFileForReading() + content = self._readContentFromFileDescriptor() + self._closeFile() + return content + + def writeContent(self, content): + self._openFileForWriting() + self._writeContentOnFileDescriptor(content) + self._closeFile() + + def _openFileForReading(self): + self._openFile(QIODevice.ReadOnly) + + def _openFileForWriting(self): + self._openFile(QIODevice.WriteOnly) + + def _openFile(self, open_mode): + self._file_descriptor = QFile(self._file_path) + if not self._file_descriptor.open(open_mode): + raise FileError, unicode(self._file_descriptor.errorString()) + + def _closeFile(self): + if self._file_descriptor is not None: + self._file_descriptor.close() + + def _readContentFromFileDescriptor(self): + stream = self._getStreamFromFileDescriptor() + return unicode(stream.readAll()) + + def _writeContentOnFileDescriptor(self, content): + stream = self._getStreamFromFileDescriptor() + stream << content + + def _getStreamFromFileDescriptor(self): + stream = QTextStream(self._file_descriptor) + stream.setCodec(self._codec) + return stream \ No newline at end of file diff --git a/tools/latex2image/__init__.py b/tools/latex2image/__init__.py new file mode 100644 index 0000000..2df19fc --- /dev/null +++ b/tools/latex2image/__init__.py @@ -0,0 +1,18 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from converter import Converter, LatexToImageConversion + +__all__ = ["Converter", "LatexToImageConversion"] diff --git a/tools/latex2image/converter.py b/tools/latex2image/converter.py new file mode 100644 index 0000000..a5bb9fc --- /dev/null +++ b/tools/latex2image/converter.py @@ -0,0 +1,153 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import os +import sys +import subprocess +from string import Template +from uuid import uuid4 + +from PyQt4.QtCore import * + +from models import Preferences +from logs_parser import LogsParser +from tools import File, isMacintoshComputer + +class LatexToImageConversion(object): + """ + Class embedding the LaTeX to Image conversion data: + image_path is the path to the image file generated from the LaTeX source + logs is the pdflatex's logs with errors highlighted (HTML) + errors is a list of tuples (line_number, error_message) + """ + def __init__(self, source, image_path, logs, errors): + super(LatexToImageConversion, self).__init__() + self.source = source + self.image_path = image_path + self.logs = logs + self.errors = errors + +class Converter(QObject): + """ + Converts LaTeX source to image file + """ + + convertedSignal = pyqtSignal(LatexToImageConversion) + conversionAbortedSignal = pyqtSignal() + + def __init__(self, output_directory): + super(Converter, self).__init__() + assert output_directory is not None + self.output_directory = output_directory + self.latex_source = "" + self._latex_process = None + self._convert_process = None + self.logs_parser = LogsParser() + self._stopping_conversion = False + + self.unique_random_file_name = unicode(uuid4()) + self.base_file_path = os.path.join(self.output_directory, self.unique_random_file_name) + self.source_file_path = "%s.tex" % self.base_file_path + self.pdf_file_path = "%s.pdf" % self.base_file_path + self.png_file_path = "%s.png" % self.base_file_path + + self._initProcesses() + + def _initProcesses(self): + self._latex_process = QProcess() + self._latex_process.setWorkingDirectory(self.output_directory) + self._latex_process.finished.connect(self._latexTypesettingFinished) + self._latex_process.error.connect(self._latexTypesettingError) + self._convert_process = QProcess() + self._convert_process.setWorkingDirectory(self.output_directory) + self._convert_process.error.connect(self._pdfToImageConversionError) + self._convert_process.finished.connect(self._pdfToImageConversionFinished) + + def stopConversion(self): + self._stopping_conversion = True + self._killProcesses() + self._stopping_conversion = False + + def isStoppingConversion(self): + return self._stopping_conversion + + def _killProcesses(self): + self._latex_process.kill() + self._latex_process.waitForFinished() + self._convert_process.kill() + self._convert_process.waitForFinished() + + def convertLatexToImage(self, source): + self.stopConversion() + try: + self.logs_parser.clearLogsAndErrors() + self.latex_source = source + self._writeSourceCodeToFile() + self._startConversion() + except Exception, e: + self.logs_parser.addErrorMessage(unicode(e)) + self._parseErrorsFromLogs() + self._emitConversionSignalWithImagePath(None) + self.conversionAbortedSignal.emit() + + def _writeSourceCodeToFile(self): + File.writeContentToFilePath(self.latex_source, self.source_file_path) + + def _startConversion(self): + self._convertSourceFileToPDF() + + def _convertSourceFileToPDF(self): + latex2pdf_command = Template(Preferences.getLatexToPDFCommand()) + latex2pdf_command = latex2pdf_command.safe_substitute(OUTPUT_DIR=self.output_directory, FILE_NAME=self.unique_random_file_name, FILE_PATH=self.source_file_path) + self._latex_process.start(latex2pdf_command) + + def _latexTypesettingFinished(self, exit_code, exit_status): + if not self.isStoppingConversion(): + self.logs_parser.logs = unicode(self._latex_process.readAllStandardOutput(), encoding="utf-8") + if self.logs_parser.isTypesettingAborted(): + self._parseErrorsFromLogs() + self._emitConversionSignalWithImagePath(None) + self.conversionAbortedSignal.emit() + else: + self._convertPDFToImage() + + def _latexTypesettingError(self, error): + self.logs_parser.addErrorMessage("Preview Error: Can't convert the source file to PDF. Please check the LaTeX command in preview's preferences.") + self._emitConversionSignalWithImagePath(None) + self.conversionAbortedSignal.emit() + + def _convertPDFToImage(self): + pdf2image_command = Template(Preferences.getPDFToImageCommand()) + pdf2image_command = pdf2image_command.safe_substitute(PDF_PATH=self.pdf_file_path, IMAGE_PATH=self.png_file_path) + self._convert_process.start(pdf2image_command) + + def _pdfToImageConversionFinished(self, exit_code, exit_status): + if not self.isStoppingConversion(): + if exit_status != 0: + self.logs_parser.addErrorMessage("PDF to image conversion failed!") + + self._parseErrorsFromLogs() + self._emitConversionSignalWithImagePath(self.png_file_path) + + def _pdfToImageConversionError(self, error): + self.logs_parser.addErrorMessage("Preview Error: Can't convert the PDF preview to image. Please check the PDF to image command in preview's preferences.") + self._emitConversionSignalWithImagePath(None) + self.conversionAbortedSignal.emit() + + def _parseErrorsFromLogs(self): + self.logs_parser.parseErrorsFromLogs() + + def _emitConversionSignalWithImagePath(self, image_path): + self.convertedSignal.emit(LatexToImageConversion(self.latex_source, image_path, self.logs_parser.getStyledLogs(), self.logs_parser.errors)) \ No newline at end of file diff --git a/tools/latex2image/logs_parser.py b/tools/latex2image/logs_parser.py new file mode 100644 index 0000000..8862499 --- /dev/null +++ b/tools/latex2image/logs_parser.py @@ -0,0 +1,131 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import re + +class LogsParser(object): + """ + Extracts errors from pdflatex output logs + """ + + ERROR_REGEXP = re.compile(r"^.*\:(?P[0-9]+): (?P.+)$") + UNDEFINED_CSEQ_REGEXP = re.compile(r".*(?P\\[^ ]*) ?$") + + def __init__(self): + super(LogsParser, self).__init__() + self._logs_lines = [] + self._errors = [] + + @property + def errors(self): + return sorted(self._errors, key=lambda error: error[0]) + + @errors.setter + def errors(self, errors): + self._errors = errors + + @property + def logs(self): + return "\n".join(self._logs_lines) + + @logs.setter + def logs(self, logs): + self._logs_lines = self._unwrapLogs(logs) + + def hasFoundErrors(self): + return len(self._errors) > 0 + + def isTypesettingAborted(self): + logs = self.logs + return "Fatal error occurred" in logs or "No pages of output." in logs + + def clearLogsAndErrors(self): + self._logs_lines = [] + self._errors = [] + + def addErrorMessage(self, message, line_number=None): + error = (line_number, message) + if error not in self._errors: + self._errors.append(error) + + def parseErrorsFromLogs(self): + match_error = None + match_cseq = None + waiting_undefined_control_sequence = False + undefined_control_sequence_line = None + + for line in self._logs_lines: + if line == "": + continue + + elif waiting_undefined_control_sequence: + match_cseq = LogsParser.UNDEFINED_CSEQ_REGEXP.match(line) + if match_cseq: + error_message = "Undefined control sequence %s." % match_cseq.group("seq") + self.addErrorMessage(error_message, undefined_control_sequence_line) + waiting_undefined_control_sequence = False + undefined_control_sequence_line = None + + elif line[0] == "!": + self.addErrorMessage(line[2:], None) + continue + + else: + match_error = LogsParser.ERROR_REGEXP.match(line) + if match_error: + try: + error_line = int(match_error.group("line")) + error_message = match_error.group("error") + + if error_message == "Undefined control sequence.": + undefined_control_sequence_line = error_line + waiting_undefined_control_sequence = True + else: + self.addErrorMessage(error_message, error_line) + except ValueError, e: + pass + + def _unwrapLogs(self, logs): + """ + Returns the given logs after unwraping the lines + """ + unwrapped_logs = [] + lines = logs.split("\n") + line_buffer = "" + for line in lines: + if self._isLineWrapped(line): + line_buffer += line + continue + unwrapped_logs.append(line_buffer + line) + line_buffer = "" + return unwrapped_logs + + def _isLineWrapped(self, line): + return (len(line) == 79) + + def getStyledLogs(self): + """ + Returns the logs with error message in red (HTML). + """ + styled_logs = [] + match = None + for line in self._logs_lines: + if line != "": + match = LogsParser.ERROR_REGEXP.match(line) + if match or line[0] == "!": + line = '%s' % line + styled_logs.append(line) + + return "
".join(styled_logs) diff --git a/tools/qt/__init__.py b/tools/qt/__init__.py new file mode 100644 index 0000000..f50c3eb --- /dev/null +++ b/tools/qt/__init__.py @@ -0,0 +1,20 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from actions import ActionFactory +from toolbar import ToolBarFactory +from dialogs import Dialogs + +__all__ = ["ActionFactory", "ToolBarFactory", "Dialogs"] diff --git a/tools/qt/actions.py b/tools/qt/actions.py new file mode 100644 index 0000000..9ccb8de --- /dev/null +++ b/tools/qt/actions.py @@ -0,0 +1,46 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +class ActionFactory(object): + """ + Helper functions to create Qt actions + """ + + @staticmethod + def createAction(parent, text, tip=None, shortcut=None, slot=None, checkable=False, icon=None): + a = QAction(text, parent) + if icon is not None: + a.setIcon(QIcon(":/%s.png" % icon)) + if shortcut is not None: + a.setShortcut(shortcut) + if tip is not None: + a.setToolTip(tip) + a.setStatusTip(tip) + if slot is not None: + a.triggered.connect(slot) + if checkable: + a.setCheckable(True) + return a + + @staticmethod + def addActionsToMenu(actions, menu): + for action in actions: + if action is None: + menu.addSeparator() + else: + menu.addAction(action) \ No newline at end of file diff --git a/tools/qt/dialogs.py b/tools/qt/dialogs.py new file mode 100644 index 0000000..06e5bba --- /dev/null +++ b/tools/qt/dialogs.py @@ -0,0 +1,62 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +class Dialogs(object): + """ + Dialogs is a wrapper to QT's dialogs + """ + SAVE = 1 + DISCARD = 2 + CANCEL = 3 + + @staticmethod + def closeDialog(title, text, parent_view=None): + dialog = QMessageBox(parent_view) + dialog.setText(title) + dialog.setInformativeText(text) + dialog.setStandardButtons(QMessageBox.Discard | QMessageBox.Save | QMessageBox.Cancel) + dialog.setDefaultButton(QMessageBox.Save) + dialog.setWindowModality(Qt.WindowModal) + response = dialog.exec_() + ret = Dialogs.CANCEL + if response == QMessageBox.Save: + ret = Dialogs.SAVE + elif response == QMessageBox.Discard: + ret = Dialogs.DISCARD + return ret + + + @staticmethod + def askQuestion(title, question, parent_view=None): + answer = QMessageBox.question(parent_view, title, question, QMessageBox.Yes | QMessageBox.No) + return answer == QMessageBox.Yes + + @staticmethod + def showError(error_message): + if isinstance(error_message, Exception): + import logging + logging.exception(error_message) + error_message = str(error_message) + QMessageBox.critical(None, "Error", error_message) + + @staticmethod + def selectFont(base_font=None): + (selected_font, is_selected) = QFontDialog.getFont(base_font) + if not is_selected: + selected_font = None + return selected_font \ No newline at end of file diff --git a/tools/qt/toolbar.py b/tools/qt/toolbar.py new file mode 100644 index 0000000..8a18d53 --- /dev/null +++ b/tools/qt/toolbar.py @@ -0,0 +1,57 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtGui import * +from PyQt4.QtCore import * + +class ToolBarFactory(object): + """ + Helper functions to create Qt toolbars + """ + + @staticmethod + def createToolBar(parent, name): + toolbar = QToolBar(name, parent) + toolbar.setMovable(False) + toolbar.setFloatable(False) + parent.addToolBar(Qt.TopToolBarArea, toolbar) + return toolbar + + @staticmethod + def addItemsToToolBar(items, toolbar): + for item in items: + if item is None: + ToolBarFactory.addSpacerToToolBar(toolbar) + elif isinstance(item, QAction): + toolbar.addAction(item) + elif isinstance(item, tuple): + ToolBarFactory.addMenuToToolBar(item[0], item[1], toolbar) + elif isinstance(item, QWidget): + toolbar.addWidget(item) + + @staticmethod + def addSpacerToToolBar(toolbar): + spacer = QWidget() + spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + toolbar.addWidget(spacer) + + @staticmethod + def addMenuToToolBar(title, menu, toolbar): + button = QToolButton() + button.setToolButtonStyle(Qt.ToolButtonTextOnly) + button.setDefaultAction(QAction(title, button)) + button.setMenu(menu) + button.setPopupMode(QToolButton.InstantPopup) + toolbar.addWidget(button) diff --git a/tools/temp_dir.py b/tools/temp_dir.py new file mode 100644 index 0000000..a851b90 --- /dev/null +++ b/tools/temp_dir.py @@ -0,0 +1,48 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import tempfile +import shutil + +class TemporaryDirectoryError(Exception): + pass + +class TemporaryDirectory(object): + """ + Temporary Directory is a tool to generates an application-wide temporary directory. + Don't forget to delete it using TemporaryDirectory.delete() when the application quits. + """ + temporary_directory = None + + @staticmethod + def get(): + if not TemporaryDirectory.temporary_directory: + TemporaryDirectory.generate() + return TemporaryDirectory.temporary_directory + + @staticmethod + def generate(): + try: + TemporaryDirectory.temporary_directory = tempfile.mkdtemp(prefix="tikz_") + except Exception, e: + raise TemporaryDirectoryError("Can't create a temporary directory: %s" % str(e)) + + @staticmethod + def delete(): + try: + if TemporaryDirectory.temporary_directory is not None: + shutil.rmtree(TemporaryDirectory.temporary_directory) + except Exception, e: + pass \ No newline at end of file diff --git a/views/__init__.py b/views/__init__.py new file mode 100644 index 0000000..2db961d --- /dev/null +++ b/views/__init__.py @@ -0,0 +1,19 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from factory import ViewFactory +from document import DocumentView + +__all__ = ['ViewFactory', 'DocumentView'] diff --git a/views/about.py b/views/about.py new file mode 100644 index 0000000..3c0e4ff --- /dev/null +++ b/views/about.py @@ -0,0 +1,64 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +import globals + +class AboutView(QMainWindow): + """ + About window. + """ + def __init__(self, parent=None): + super(AboutView, self).__init__(parent) + self.app_controller = None + self.image = QLabel() + self.title_label = QLabel("

TikZ Editor

") + version = globals.VERSION + if globals.GIT_VERSION != u'': + version += ' (%s)' % globals.GIT_VERSION + self.version_label = QLabel("
Version %s
" % version) + self.copyright_label = QLabel("
Copyright 2012 %s
" % globals.AUTHORS) + self.info_text = QTextEdit() + + def initView(self): + self.image.setAlignment(Qt.AlignCenter) + self.info_text.setReadOnly(True) + self._initWindowProperties() + self._initLayout() + + def setInfoHTML(self, content): + self.info_text.setText(content) + + def setImage(self, path): + self.image.setPixmap(QPixmap(path)) + + def _initWindowProperties(self): + self.setWindowTitle("About TikZ Editor") + self.setFixedWidth(300) + self.setFixedHeight(350) + + def _initLayout(self): + content = QWidget() + layout = QVBoxLayout() + layout.setContentsMargins(0, 10, 0, 10) + layout.addWidget(self.image) + layout.addWidget(self.title_label) + layout.addWidget(self.version_label) + layout.addWidget(self.info_text) + layout.addWidget(self.copyright_label) + content.setLayout(layout) + self.setCentralWidget(content) \ No newline at end of file diff --git a/views/document/__init__.py b/views/document/__init__.py new file mode 100644 index 0000000..e443344 --- /dev/null +++ b/views/document/__init__.py @@ -0,0 +1,156 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from models import Preferences +from tools import isMacintoshComputer +from tools.qt import Dialogs, ActionFactory + +class DocumentView(QMainWindow): + """ + TikZ document window. This class is just the root of the document views hierarchy. + """ + sourceChangedSignal = pyqtSignal(str) + preambleChangedSignal = pyqtSignal(str) + + def __init__(self, parent=None): + super(DocumentView, self).__init__(parent) + self.app_controller = None + self.doc_controller = None + self.content_view = None + self.feedback_view = None + self.preview_view = None + self.editor_splitter = None + self.main_splitter = None + + def initView(self): + if not isMacintoshComputer(): + self.setMenuBar(self.app_controller.menu_bar) + self._initSubViews() + self._restoreWindowState() + self._initSignalsConnections() + self.content_view.current_editor_view.setFocus() + + def _initSubViews(self): + self.editor_splitter = QSplitter(self) + self.editor_splitter.setOrientation(Qt.Vertical) + self.editor_splitter.addWidget(self.content_view) + self.editor_splitter.addWidget(self.feedback_view) + self.editor_splitter.setStretchFactor(0, 2) + self.editor_splitter.setStretchFactor(1, 1) + if Preferences.hasEditorSplitterState(): + self.editor_splitter.restoreState(Preferences.getEditorSplitterState()) + + self.main_splitter = QSplitter(self) + self.main_splitter.setOrientation(Qt.Horizontal) + self.main_splitter.addWidget(self.editor_splitter) + self.main_splitter.addWidget(self.preview_view) + if Preferences.hasMainSplitterState(): + self.main_splitter.restoreState(Preferences.getMainSplitterState()) + else: + self.main_splitter.setSizes([self.width() / 2] * 2) + + self.setCentralWidget(self.main_splitter) + + def _restoreWindowState(self): + if Preferences.hasWindowGeometry(): + self.restoreGeometry(Preferences.getWindowGeometry()) + else: + self.setWindowState(Qt.WindowMaximized) + + def _initSignalsConnections(self): + self.content_view.source_editor_view.contentChangedSignal.connect(self.sourceEditorContentChanged) + self.content_view.preamble_editor_view.contentChangedSignal.connect(self.preambleEditorContentChanged) + + def _saveWindowState(self): + Preferences.setWindowGeometry(self.saveGeometry()) + Preferences.setEditorSplitterState(self.editor_splitter.saveState()) + Preferences.setMainSplitterState(self.main_splitter.saveState()) + + @property + def title(self): + return self.getWindowTitle() + + @title.setter + def title(self, title): + # set the title of the window with "dirty" placeholder + self.setWindowTitle("%s[*]" % title) + + @pyqtSlot(str) + def setTitle(self, title): + self.title = title + + @property + def source(self): + return self.content_view.source_editor_view.content + + @source.setter + def source(self, source): + source = unicode(source) + if self.source != source: + self.content_view.source_editor_view.content = source + self.sourceChangedSignal.emit(source) + + + @pyqtSlot(str) + def setSource(self, source): + self.source = source + + @property + def preamble(self): + return self.content_view.preamble_editor_view.content + + @preamble.setter + def preamble(self, preamble): + preamble = unicode(preamble) + if self.preamble != preamble: + self.content_view.preamble_editor_view.content = preamble + self.preambleChangedSignal.emit(preamble) + + @pyqtSlot(str) + def setPreamble(self, preamble): + self.preamble = preamble + + @pyqtSlot() + def sourceEditorContentChanged(self): + self.sourceChangedSignal.emit(self.source) + + @pyqtSlot() + def preambleEditorContentChanged(self): + self.preambleChangedSignal.emit(self.preamble) + + def closeEvent(self, event=None): + if self.doc_controller.model.isDirty(): + response = self._userWantToSave() + if response == Dialogs.SAVE: + self.doc_controller.save() + elif event is not None and response == Dialogs.CANCEL: + event.ignore() + + self._saveWindowState() + + 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) + + @pyqtSlot() + def documentDirtied(self): + self.setWindowModified(True) + + @pyqtSlot() + def documentSaved(self): + self.setWindowModified(False) + \ No newline at end of file diff --git a/views/document/content.py b/views/document/content.py new file mode 100644 index 0000000..ecd5ed0 --- /dev/null +++ b/views/document/content.py @@ -0,0 +1,127 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +import globals.actions as actions +from tools.qt import ActionFactory, ToolBarFactory + +class ContentView(QMainWindow): + """ + The content view displays the source and preamble editors. + """ + def __init__(self, parent=None): + super(QMainWindow, self).__init__(parent) + self.app_controller = None + self.source_editor_view = None + self.preamble_editor_view = None + self.stacked_widget = None + self.actions = {} + + @property + def current_editor_view(self): + return self.stacked_widget.currentWidget() + + @current_editor_view.setter + def current_editor_view(self, view): + self.stacked_widget.setCurrentWidget(view) + view.setFocus() + + def initView(self): + self.source_editor_view.cursorPositionChanged.connect(self._sourceCursorPositionChanged) + self.source_editor_view.selectionChanged.connect(self._sourceSelectionChanged) + self.source_editor_view.modificationAttempted.connect(self._sourceModificationAttemptedWhileReadOnly) + self._initToolBar() + self._initStackedWidgets() + + def _initToolBar(self): + toolbar = ToolBarFactory.createToolBar(self, "Content") + self._initToolBarActions(toolbar) + + 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) + + def _initStackedWidgets(self): + self.stacked_widget = QStackedWidget(self) + self.stacked_widget.addWidget(self.source_editor_view) + self.stacked_widget.addWidget(self.preamble_editor_view) + self.setCentralWidget(self.stacked_widget) + + def showSourceView(self): + self.current_editor_view = self.source_editor_view + if not self.actions[actions.SHOW_SOURCE].isChecked(): + self.actions[actions.SHOW_SOURCE].setChecked(True) + + def showPreambleView(self): + self.current_editor_view = self.preamble_editor_view + if not self.actions[actions.SHOW_PREAMBLE].isChecked(): + self.actions[actions.SHOW_PREAMBLE].setChecked(True) + + def toggleViews(self): + if self.current_editor_view is self.source_editor_view: + self.showPreambleView() + else: + self.showSourceView() + + def _sourceModificationAttemptedWhileReadOnly(self): + source = self.source_editor_view + (line, index) = source.getCursorPosition() + if (line > 0 and line < source.lines() - 1) or line == 0 and index > 18: + source.setReadOnly(False) + else: + # fire system alert sound + QApplication.beep() + + def _sourceCursorPositionChanged(self, line, index): + source = self.source_editor_view + content = source.content + if not (content.startswith("\\begin{tikzpicture}") and content.startswith("\\begin{tikzpicture")): + source.content = "\\begin{tikzpicture}" + content[18:] + if line == 0 and index < 20: + source.setCursorPosition(0, 19) + source.setReadOnly(True) + elif line == source.lines() - 1: + source.setCursorPosition(source.lines() - 2, source.lineSize(source.lines() - 1)) + source.setReadOnly(True) + + def _sourceSelectionChanged(self): + source = self.source_editor_view + (line_from, index_from, line_to, index_to) = source.getSelection() + selection_changed = False + if line_from == 0 and index_from < 19: + index_from = 19 + selection_changed = True + if line_to == source.lines() - 1: + line_to = source.lines() - 2 + index_to = source.lineSize(line_to + 1) + selection_changed = True + if selection_changed: + source.setSelection(line_from, index_from, line_to, index_to) \ No newline at end of file diff --git a/views/document/feedback/__init__.py b/views/document/feedback/__init__.py new file mode 100644 index 0000000..59135ca --- /dev/null +++ b/views/document/feedback/__init__.py @@ -0,0 +1,85 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +import globals.actions as actions +from models import Preferences +from tools.qt import ActionFactory, ToolBarFactory + +LOGS_VIEW = 0 +ERRORS_VIEW = 1 + +class FeedbackView(QMainWindow): + """ + The feedback view displays the pdf2image converter error and logs views. + """ + + SHOW_ERRORS_ACTION = "showError" + SHOW_LOGS_ACTION = "showLogs" + + def __init__(self, parent=None): + super(QMainWindow, self).__init__(parent) + self.app_controller = None + self.errors_view = None + self.logs_view = None + self.stacked_widget = None + self.actions = {} + + def initView(self): + self._initToolBar() + self._initStackedWidgets() + self._initSelectedView() + + def _initToolBar(self): + toolbar = ToolBarFactory.createToolBar(self, "Feedback") + self._initToolBarActions(toolbar) + + 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) + + def _initStackedWidgets(self): + self.stacked_widget = QStackedWidget(self) + self.stacked_widget.addWidget(self.logs_view) + self.stacked_widget.addWidget(self.errors_view) + self.setCentralWidget(self.stacked_widget) + + def _initSelectedView(self): + selected_view = Preferences.getSelectedFeedbackView() + if selected_view == ERRORS_VIEW: + self.showErrorsView() + else: + self.showLogsView() + + def showLogsView(self): + self.stacked_widget.setCurrentWidget(self.logs_view) + Preferences.setSelectedFeedbackView(LOGS_VIEW) + if not self.actions[actions.SHOW_LOGS].isChecked(): + self.actions[actions.SHOW_LOGS].setChecked(True) + + def showErrorsView(self): + self.stacked_widget.setCurrentWidget(self.errors_view) + Preferences.setSelectedFeedbackView(ERRORS_VIEW) + if not self.actions[actions.SHOW_ERRORS].isChecked(): + self.actions[actions.SHOW_ERRORS].setChecked(True) \ No newline at end of file diff --git a/views/document/feedback/errors.py b/views/document/feedback/errors.py new file mode 100644 index 0000000..cbcb90c --- /dev/null +++ b/views/document/feedback/errors.py @@ -0,0 +1,44 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +class ErrorListItem(QListWidgetItem): + def __init__(self, error, parent=None): + super(ErrorListItem, self).__init__(unicode(error), parent) + self.error = error + +class ErrorsView(QListWidget): + """ + The errors view displays the list of pdf2image converter errors. + """ + errorSelectedSignal = pyqtSignal(object) + + def __init__(self, parent=None): + super(ErrorsView, self).__init__(parent) + self.app_controller = None + + def initView(self): + self.itemClicked.connect(self.errorSelected) + + def clearErrors(self): + self.clear() + + def addError(self, error): + ErrorListItem(error, self) + + def errorSelected(self, error_list_item): + self.errorSelectedSignal.emit(error_list_item.error) \ No newline at end of file diff --git a/views/document/feedback/logs.py b/views/document/feedback/logs.py new file mode 100644 index 0000000..9eb47d9 --- /dev/null +++ b/views/document/feedback/logs.py @@ -0,0 +1,38 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +class LogsView(QTextEdit): + """ + The logs view displays pdf2image converter logs. + """ + def __init__(self, parent=None): + super(LogsView, self).__init__(parent) + self.app_controller = None + + def initView(self): + self.setReadOnly(True) + + def clearLogs(self): + self.clear() + + def setLogs(self, logs): + self.setHtml(logs) + self.scrollToEnd() + + def scrollToEnd(self): + self.moveCursor(QTextCursor.End) \ No newline at end of file diff --git a/views/document/preview.py b/views/document/preview.py new file mode 100644 index 0000000..666defd --- /dev/null +++ b/views/document/preview.py @@ -0,0 +1,95 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +class PreviewView(QScrollArea): + """ + The preview view displays the preview of the TikZ figure. + """ + + NORMAL_BACKGROUND_COLOR = "white" + WAITING_BACKGROUND_COLOR = "#F5F5F5" + ERROR_BACKGROUND_COLOR = "#FFE8E8" + + def __init__(self, parent=None): + super(PreviewView, self).__init__(parent) + self.app_controller = None + self._figure_view = None + self.setWidgetResizable(True) + self.showNormalBackground() + + self.last_cursor_position_x = 0 + self.last_cursor_position_y = 0 + + @property + def figure_view(self): + return self._figure_view + + @figure_view.setter + def figure_view(self, figure_view): + figure_view.setAlignment(Qt.AlignCenter) + self._figure_view = figure_view + self.setWidget(figure_view) + + @property + def figure(self): + return self.figure_view.pixmap() + + @figure.setter + def figure(self, image_file_path): + assert image_file_path is not None + self.figure_view.setPixmap(QPixmap(image_file_path)) + + def showWaitingBackground(self): + self.setBackgroundColor(PreviewView.WAITING_BACKGROUND_COLOR) + + def showNormalBackground(self): + self.setBackgroundColor(PreviewView.NORMAL_BACKGROUND_COLOR) + + def showErrorBackground(self): + self.setBackgroundColor(PreviewView.ERROR_BACKGROUND_COLOR) + + def setBackgroundColor(self, color): + self.setStyleSheet("QLabel { background-color: %s}" % color) + + def mousePressEvent(self, event): + # store the current position of cursor + self.last_cursor_position_x = event.pos().x() + self.last_cursor_position_y = event.pos().y() + + # hide mouse pointer + self.parent().setCursor(QCursor(Qt.BlankCursor)) + + def mouseReleaseEvent(self, event): + # show mouse pointer + self.parent().unsetCursor() + + def mouseMoveEvent(self, event): + # scroll the figure when the user is dragging it + x = event.pos().x() + y = event.pos().y() + dx = self.last_cursor_position_x - x + dy = self.last_cursor_position_y - y + self.scrollBy(dx, dy) + self.last_cursor_position_x = x + self.last_cursor_position_y = y + + def scrollBy(self, dx, dy): + x = self.horizontalScrollBar().value() + y = self.verticalScrollBar().value() + self.horizontalScrollBar().setValue(x + dx); + self.verticalScrollBar().setValue(y + dy); diff --git a/views/document/properties.py b/views/document/properties.py new file mode 100644 index 0000000..58759cb --- /dev/null +++ b/views/document/properties.py @@ -0,0 +1,62 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +class TestWidget(QWidget): + def __init__(self, parent=None): + super(TestWidget, self).__init__(parent) + + s = QStackedWidget() + s.addWidget(QLabel("Property Page 1")) + s.addWidget(QLabel("Property Page 2")) + s.addWidget(QLabel("Property Page 3")) + + p = QComboBox() + p.addItem("Property Page 1") + p.addItem("Property Page 2") + p.addItem("Property Page 3") + + self.connect(p, SIGNAL("activated(int)"), s, SLOT("setCurrentIndex(int)")) + + l = QVBoxLayout() + l.addWidget(p) + l.addWidget(s) + self.setLayout(l) + + +class PropertiesView(QDockWidget): + """ + The property view shows the properties of TikZ objects. + This view is not used at the moment, it should be displayed as a dock on the + document window. + """ + def __init__(self, parent=None): + super(PropertiesView, self).__init__("Object Properties", parent) + self.app_controller = None + + # dock widget configuration + self.setObjectName("ObjectPropertiesWidget") + self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) + self.setFeatures(QDockWidget.DockWidgetMovable) + + # add the view as a dock to parent window + parent.addDockWidget(Qt.RightDockWidgetArea, self) + + self.setWidget(TestWidget()) + + def initView(self): + pass \ No newline at end of file diff --git a/views/editor.py b/views/editor.py new file mode 100644 index 0000000..d269a23 --- /dev/null +++ b/views/editor.py @@ -0,0 +1,296 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * +from PyQt4.Qsci import * + +import globals.editor +from models import Preferences + +class LexerTikZ(QsciLexerTeX): + """ + Scintilla lexer used for syntax-highlighting TikZ sources. + """ + def __init__(self, parent=None): + super(LexerTikZ, self).__init__(parent) + + def keywords(self, keyword_set): + """ + Returns the TikZ keywords + """ + keywords = super(LexerTikZ, self).keywords(keyword_set) + if keyword_set == 1: + keywords += ' ' + ' '.join(globals.editor.TIKZ_KEYWORDS) + return keywords + + def defaultColor(self, style): + """ + Returns the color for each style + """ + color = super(LexerTikZ, self).defaultColor(style) + if style == LexerTikZ.Default: # LaTeX comments (without leading %) + color = QColor(globals.editor.EDITOR_COMMENTS_COLOR) + elif style == LexerTikZ.Special: # Symbols ()[]<>= + color = QColor(globals.editor.EDITOR_SYMBOLS1_COLOR) + elif style == LexerTikZ.Group: # Symbols {}$ + color = QColor(globals.editor.EDITOR_SYMBOLS2_COLOR) + elif style == LexerTikZ.Symbol: # Leading % of LaTeX comments + color = QColor(globals.editor.EDITOR_COMMENTS_COLOR) + elif style == LexerTikZ.Command: # LaTeX commands prefixed by \ + color = QColor(globals.editor.EDITOR_KEYWORDS_COLOR) + elif style == LexerTikZ.Text: # Rest of the source + color = QColor(globals.editor.EDITOR_TEXT_COLOR) + return color + + def defaultFont(self, style): + """ + Returns the font for each style + """ + font = super(LexerTikZ, self).defaultFont(style) + if style == LexerTikZ.Default: # LaTeX comments (without leading %) + font.setBold(globals.editor.EDITOR_COMMENTS_BOLD) + font.setItalic(globals.editor.EDITOR_COMMENTS_ITALIC) + elif style == LexerTikZ.Special: # Symbols ()[]<> + font.setBold(globals.editor.EDITOR_SYMBOLS1_BOLD) + font.setItalic(globals.editor.EDITOR_SYMBOLS1_ITALIC) + elif style == LexerTikZ.Group: # Symbols {} + font.setBold(globals.editor.EDITOR_SYMBOLS2_BOLD) + font.setItalic(globals.editor.EDITOR_SYMBOLS2_ITALIC) + elif style == LexerTikZ.Symbol: # Leading % of LaTeX comments + font.setBold(globals.editor.EDITOR_COMMENTS_BOLD) + font.setItalic(globals.editor.EDITOR_COMMENTS_ITALIC) + elif style == LexerTikZ.Command: # LaTeX commands prefixed by \ + font.setBold(globals.editor.EDITOR_KEYWORDS_BOLD) + font.setItalic(globals.editor.EDITOR_KEYWORDS_ITALIC) + elif style == LexerTikZ.Text: # Rest of the source + font.setBold(globals.editor.EDITOR_TEXT_BOLD) + font.setItalic(globals.editor.EDITOR_TEXT_ITALIC) + return font + +class EditorView(QsciScintilla): + """ + View used for editing TikZ source code. This is a subclass of QScintilla's editor. + """ + + ERROR_MARGIN_MARKER = 8 + SNIPPET_CURSOR_PLACEHOLDER = "@@@" + + contentChangedSignal = pyqtSignal() + + # list of instances used to reload user preferences in real-time + instances = [] + + @staticmethod + def reloadUserPreferences(): + """ + Reloads user preferences of all EditorView instances in real-time + """ + for editor in EditorView.instances: + editor.loadUserPreferences() + + def __init__(self, parent=None): + super(EditorView, self).__init__(parent) + self.app_controller = None + self.show_margin = True + EditorView.instances.append(self) + + def initView(self, show_margin=True): + self.show_margin = show_margin + self._initEditor() + self._initConnections() + self.loadUserPreferences() + + def _initEditor(self): + # margins + self.setMarginSensitivity(1, True) + + # margin markers + self.markerDefine(QsciScintilla.RightArrow, EditorView.ERROR_MARGIN_MARKER) + self.setMarkerBackgroundColor(QColor("#ee1111"), EditorView.ERROR_MARGIN_MARKER) + + # options + self.setAutoIndent(True) + + # annotations + self.setAnnotationDisplay(self.AnnotationBoxed) + + # customize annotations style (not used because of a bug, only the first instance + # of EditorView is styled) + #self.SendScintilla(QsciScintilla.SCI_SETSTYLEBITS, 7) + #QsciStyle(6, "annotations", QColor(31, 116, 224), QColor(31, 116, 224), font) + + def _initConnections(self): + self.textChanged.connect(self.contentChangedSignal) + + def loadUserPreferences(self): + # editor font + font = Preferences.getEditorFont() + self.setFont(font) + lexer = LexerTikZ() + lexer.setDefaultFont(font) + self.setLexer(lexer) + + # margins + if self.show_margin: + self._setMarginFont(font) + else: + self._hideMargin() + + # auto-wrap + auto_wrap = Preferences.getAutoWrap() + self.setWrapMode(auto_wrap) + if auto_wrap: + # hide horizontal scrollbar + self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) + else: + # show horizontal scrollbar + self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 1) + self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTH, 1) + self.SendScintilla(QsciScintilla.SCI_SETSCROLLWIDTHTRACKING, 1) + + # file encoding + encoding = Preferences.getFileEncoding() + self.setUtf8(encoding == Preferences.ENCODING_UTF8) + + # line endings + line_endings = Preferences.getLineEndings() + if line_endings == Preferences.LINE_ENDINGS_WINDOWS: + self.setEolMode(EditorView.EolWindows) + elif line_endings == Preferences.LINE_ENDINGS_MAC: + self.setEolMode(EditorView.EolMac) + else: + self.setEolMode(EditorView.EolUnix) + + # indentation type + indentation_type = Preferences.getIndentationType() + self.setIndentationsUseTabs(indentation_type == Preferences.INDENT_TAB) + + # indentation size + self.setTabWidth(Preferences.getIndentationSize()) + + def _hideMargin(self): + self.setMarginWidth(1, 0) + + def _setMarginFont(self, font): + fontmetrics = QFontMetrics(font) + self.setMarginsFont(font) + # use margin 0 for line numbers + self.setMarginWidth(0, fontmetrics.width("0000") + 6) + self.setMarginLineNumbers(0, True) + + + @property + def content(self): + return unicode(self.text()) + + @content.setter + def content(self, content): + self.setText(content) + + def insertSnippet(self, snippet): + """ + Inserts a code snippet to current position. + The cursor position is set to the placeholder SNIPPET_CURSOR_PLACEHOLDER (@@@). + """ + wanted_position = snippet.find(EditorView.SNIPPET_CURSOR_PLACEHOLDER) + if wanted_position == -1: + wanted_position = len(snippet) + self.insert(snippet) + else: + (snippet_before_cursor, snippet_after_cursor) = snippet.split(EditorView.SNIPPET_CURSOR_PLACEHOLDER, 1) + self.insert(snippet_after_cursor) + self.insert(snippet_before_cursor) + + # offset the cursor to wanted position + (current_line, current_position) = self.getCursorPosition() + self.setCursorPosition(current_line, current_position + wanted_position) + + def getLastLine(self): + """ + Returns the number of the last line + """ + return self.lines() + + def lineSize(self, line): + """ + Returns the size (in characters) of a line + """ + size = 0 + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + size = len(unicode(self.text(line_index)).rstrip()) + return size + + def selectLine(self, line): + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + self.ensureLineVisible(line_index) + self.setSelection(line_index, 0, line_index, self.lineSize(line)) + + def goToLine(self, line): + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + self.setCursorPosition(line_index, 0) + + def goToPosition(self, line, index): + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + self.setCursorPosition(line_index, index) + + def _isValidLineNumber(self, line): + """ + Returns whether the given line is between the bound of the document + """ + return line > 0 and line <= self.lines() + + def _convertLineNumberToLineIndex(self, line): + """ + Converts a line number to line index to match QScintilla's methods + """ + assert line > 0 + return line - 1 + + def removeAllErrorMarginMarkers(self): + self.markerDeleteAll(EditorView.ERROR_MARGIN_MARKER) + + def addErrorMarginMarkerToLine(self, line): + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + self.markerAdd(line_index, EditorView.ERROR_MARGIN_MARKER) + + def removeErrorMarginMarkerFromLine(self, line): + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + self.markerDelete(line_index, EditorView.ERROR_MARGIN_MARKER) + + def removeAllAnnotations(self): + self.clearAnnotations() + + def addAnnotationToLine(self, line, annotation): + if self._isValidLineNumber(line): + line_index = self._convertLineNumberToLineIndex(line) + old_annotation = self.annotation(line_index) + if old_annotation: + annotation = "%s\n%s" % (old_annotation, annotation) + self.annotate(line_index, annotation, 2) + + def getCharacterAtCurrentCursorPosition(self): + char = "" + (line_nb, col_nb) = self.getCursorPosition() + line = self.text(line_nb) + if col_nb < len(line): + char = line[col_nb] + return char \ No newline at end of file diff --git a/views/factory.py b/views/factory.py new file mode 100644 index 0000000..1868a13 --- /dev/null +++ b/views/factory.py @@ -0,0 +1,161 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from about import AboutView +from document import DocumentView +from document.content import ContentView +from document.preview import PreviewView +from document.feedback import FeedbackView +from document.feedback.logs import LogsView +from document.feedback.errors import ErrorsView +from document.properties import PropertiesView +from preferences import PreferencesView +from preferences.document import DocumentPreferencesView +from preferences.editor import EditorPreferencesView +from preferences.preview import PreviewPreferencesView +from preferences.snippets import SnippetsPreferencesView +from editor import EditorView + +class ViewFactory(object): + """ + Factory of all views. + """ + + @staticmethod + def createAboutView(app_controller): + about = AboutView() + about.app_controller = app_controller + about.initView() + return about + + @staticmethod + def createDocumentView(app_controller, doc_controller): + doc = DocumentView() + doc.app_controller = app_controller + doc.doc_controller = doc_controller + content = ViewFactory.createContentView(app_controller, doc) + feedback = ViewFactory.createFeedbackView(app_controller, doc) + preview = ViewFactory.createPreviewView(app_controller, doc) + doc.content_view = content + doc.feedback_view = feedback + doc.preview_view = preview + doc.initView() + return doc + + @staticmethod + def createContentView(app_controller, parent=None): + content = ContentView(parent) + content.app_controller = app_controller + content.source_editor_view = ViewFactory.createEditorView(app_controller, content) + content.preamble_editor_view = ViewFactory.createEditorView(app_controller, content) + content.initView() + return content + + @staticmethod + def createEditorView(app_controller, parent=None): + editor = EditorView(parent) + editor.app_controller = app_controller + editor.initView() + return editor + + @staticmethod + def createFeedbackView(app_controller, parent=None): + feedback = FeedbackView(parent) + feedback.app_controller = app_controller + feedback.errors_view = ViewFactory.createErrorsView(app_controller, feedback) + feedback.logs_view = ViewFactory.createLogsView(app_controller, feedback) + feedback.initView() + return feedback + + @staticmethod + def createLogsView(app_controller, parent=None): + logs = LogsView(parent) + logs.app_controller = app_controller + logs.initView() + return logs + + @staticmethod + def createErrorsView(app_controller, parent=None): + errors = ErrorsView(parent) + errors.app_controller = app_controller + errors.initView() + return errors + + @staticmethod + def createPropertiesView(app_controller, parent=None): + properties = PropertiesView(parent) + properties.app_controller = app_controller + properties.initView() + return properties + + @staticmethod + def createPreviewView(app_controller, parent=None): + preview = PreviewView(parent) + preview.app_controller = app_controller + preview.figure_view = ViewFactory.createLabel(preview) + return preview + + @staticmethod + def createPreferencesView(app_controller, parent=None): + preferences = PreferencesView() + preferences.app_controller = app_controller + preferences.document = ViewFactory.createDocumentPreferencesView(app_controller, preferences) + preferences.editor = ViewFactory.createEditorPreferencesView(app_controller, preferences) + preferences.preview = ViewFactory.createPreviewPreferencesView(app_controller, preferences) + preferences.snippets = ViewFactory.createSnippetsPreferencesView(app_controller, preferences) + preferences.initView() + return preferences + + @staticmethod + def createDocumentPreferencesView(app_controller, parent=None): + document_pref = DocumentPreferencesView(parent) + document_pref.app_controller = app_controller + document_pref.initView() + return document_pref + + @staticmethod + def createEditorPreferencesView(app_controller, parent=None): + editor_pref = EditorPreferencesView(parent) + editor_pref.app_controller = app_controller + editor_pref.initView() + return editor_pref + + @staticmethod + def createPreviewPreferencesView(app_controller, parent=None): + preview_pref = PreviewPreferencesView(parent) + preview_pref.app_controller = app_controller + preview_pref.initView() + return preview_pref + + @staticmethod + def createSnippetsPreferencesView(app_controller, parent=None): + snippets_pref = SnippetsPreferencesView(parent) + snippets_pref.app_controller = app_controller + snippets_pref.initView() + return snippets_pref + + @staticmethod + def createLabel(parent=None): + return QLabel(parent) + + @staticmethod + def createLineSeparator(parent=None): + line = QFrame(parent) + line.setFrameShape(QFrame.HLine) + line.setFrameShadow(QFrame.Sunken) + return line \ No newline at end of file diff --git a/views/preferences/__init__.py b/views/preferences/__init__.py new file mode 100644 index 0000000..823877b --- /dev/null +++ b/views/preferences/__init__.py @@ -0,0 +1,148 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from tools.qt import ActionFactory, ToolBarFactory + +class PreferencesView(QMainWindow): + """ + The preferences window is used to change the user defaults. + """ + SHOW_EDITOR_ACTION = "showEditor" + SHOW_DOCUMENT_ACTION = "showDocument" + SHOW_PREVIEW_ACTION = "showPreview" + SHOW_SNIPPETS_ACTION = "showSnippets" + + def __init__(self, parent=None): + super(PreferencesView, self).__init__(parent) + self.app_controller = None + self.editor = None + self.document = None + self.preview = None + self.snippets = None + self.actions = {} + self.toolbar = None + self.stacked_widget = None + self.resize_animation = None + + def initView(self): + self._initWindowProperties() + self._initToolBar() + self._initStackedWidgets() + self._initResizeAnimation() + self.showEditorPreferences() + + def _initWindowProperties(self): + self.setWindowTitle("Preferences") + self.setFixedWidth(self.maxWidth()) + + def _initToolBar(self): + self.toolbar = ToolBarFactory.createToolBar(self, "Preferences") + self._initToolBarActions() + + 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) + + def _initStackedWidgets(self): + self.stacked_widget = QStackedWidget(self) + self.stacked_widget.addWidget(self.editor) + self.stacked_widget.addWidget(self.document) + self.stacked_widget.addWidget(self.preview) + self.stacked_widget.addWidget(self.snippets) + self.setCentralWidget(self.stacked_widget) + + def _initResizeAnimation(self): + """ + The resize animation is used to resize the preferences window to match currently + displayed view. + """ + self.resize_animation = QPropertyAnimation(self, "geometry") + self.resize_animation.setDuration(150) + self.resize_animation.finished.connect(self._resizeAnimationFinished) + + def _resizeAnimationFinished(self): + self.setMinimumHeight(self.geometry().height()) + if self.stacked_widget.currentWidget() == self.editor: + # disable window resizing in editor preferences + self.setMaximumHeight(self.geometry().height()) + + def maxWidth(self): + """ + Returns the greater width of all sub-views. + """ + min_width = 500 + editor_width = self.editor.sizeHint().width() + document_width = self.document.sizeHint().width() + preview_width = self.preview.sizeHint().width() + snippets_width = self.snippets.sizeHint().width() + return max(min_width, editor_width, preview_width) + + def showDocumentPreferences(self): + self.stacked_widget.setCurrentWidget(self.document) + if not self.actions[PreferencesView.SHOW_DOCUMENT_ACTION].isChecked(): + self.actions[PreferencesView.SHOW_DOCUMENT_ACTION].setChecked(True) + self._resizeHeightToMatchCurrentView() + + def showEditorPreferences(self): + self.stacked_widget.setCurrentWidget(self.editor) + if not self.actions[PreferencesView.SHOW_EDITOR_ACTION].isChecked(): + self.actions[PreferencesView.SHOW_EDITOR_ACTION].setChecked(True) + self._resizeHeightToMatchCurrentView() + + def showPreviewPreferences(self): + self.stacked_widget.setCurrentWidget(self.preview) + if not self.actions[PreferencesView.SHOW_PREVIEW_ACTION].isChecked(): + self.actions[PreferencesView.SHOW_PREVIEW_ACTION].setChecked(True) + self._resizeHeightToMatchCurrentView() + + def showSnippetsPreferences(self): + self.stacked_widget.setCurrentWidget(self.snippets) + if not self.actions[PreferencesView.SHOW_SNIPPETS_ACTION].isChecked(): + self.actions[PreferencesView.SHOW_SNIPPETS_ACTION].setChecked(True) + self._resizeHeightToMatchCurrentView() + + def _resizeHeightToMatchCurrentView(self): + if self.resize_animation.state() is not QPropertyAnimation.Stopped: + self.resize_animation.stop() + current_view = self.stacked_widget.currentWidget() + geometry = self.geometry() + previous_height = geometry.height() + self.resize_animation.setStartValue(geometry) + view_height = current_view.sizeHint().height() + toolbar_height = self.toolbar.sizeHint().height() + total_height = view_height + toolbar_height + geometry.setHeight(total_height) + self.setMinimumHeight(min(previous_height, total_height)) + self.setMaximumHeight(2000) + self.resize_animation.setEndValue(geometry) + self.resize_animation.start() \ No newline at end of file diff --git a/views/preferences/document.py b/views/preferences/document.py new file mode 100644 index 0000000..aefd850 --- /dev/null +++ b/views/preferences/document.py @@ -0,0 +1,95 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from models import Preferences +import views.editor +import views.factory + +class DocumentPreferencesView(QWidget): + """ + The document preferences view displays the user defaults for the TikZ documents. + """ + + latexFileTemplateChangedSignal = pyqtSignal(unicode) + preambleTemplateChangedSignal = pyqtSignal(unicode) + + def __init__(self, parent=None): + super(DocumentPreferencesView, self).__init__(parent) + self.app_controller = None + self.latex_file_label = QLabel("LaTeX file template used for saving document:") + self.latex_file_button = QPushButton("Restore Default") + self.latex_file_editor = views.editor.EditorView() + self.latex_file_help = QLabel('Code placeholders: $PREAMBLE and $SOURCE') + self.preamble_label = QLabel("Preamble used for new document:") + self.preamble_button = QPushButton("Restore Default") + self.preamble_editor = views.editor.EditorView() + + def initView(self): + self._initConnections() + self._initWidgets() + self._initLayout() + + def _initConnections(self): + self.latex_file_editor.contentChangedSignal.connect(self._latexFileChanged) + self.latex_file_button.clicked.connect(self._restoreDefaultTemplate) + self.preamble_editor.contentChangedSignal.connect(self._preambleChanged) + self.preamble_button.clicked.connect(self._restoreDefaultPreamble) + + def _initWidgets(self): + self.latex_file_editor.initView(show_margin = False) + self.preamble_editor.initView(show_margin = False) + + def _initLayout(self): + layout = QGridLayout() + layout.addWidget(self.latex_file_label, 0, 0, 1, 3) + layout.addWidget(self.latex_file_editor, 1, 0, 1, 3) + layout.addWidget(self.latex_file_help, 2, 0, 1, 2) + layout.addWidget(self.latex_file_button, 2, 2) + layout.addWidget(views.factory.ViewFactory.createLineSeparator(), 3, 0, 1, 3) + layout.addWidget(self.preamble_label, 4, 0, 1, 3) + layout.addWidget(self.preamble_editor, 5, 0, 1, 3) + layout.addWidget(self.preamble_button, 6, 2) + self.setLayout(layout) + + @property + def preamble_template(self): + return self.preamble_editor.content + + @preamble_template.setter + def preamble_template(self, value): + self.preamble_editor.content = value + + @property + def latex_file_template(self): + return self.latex_file_editor.content + + @latex_file_template.setter + def latex_file_template(self, value): + self.latex_file_editor.content = value + + def _restoreDefaultPreamble(self): + self.preamble_editor.content = Preferences.defaultPreambleTemplate() + + def _restoreDefaultTemplate(self): + self.latex_file_editor.content = Preferences.defaultLatexFileTemplate() + + def _latexFileChanged(self): + self.latexFileTemplateChangedSignal.emit(self.latex_file_template) + + def _preambleChanged(self): + self.preambleTemplateChangedSignal.emit(self.preamble_template) diff --git a/views/preferences/editor.py b/views/preferences/editor.py new file mode 100644 index 0000000..d054370 --- /dev/null +++ b/views/preferences/editor.py @@ -0,0 +1,211 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from tools.qt import Dialogs +from models import Preferences +import views.factory + +class EditorPreferencesView(QWidget): + """ + The editor preferences view displays the user preferences for the TikZ editor views. + """ + + editorFontChangedSignal = pyqtSignal(object) + fileEncodingChangedSignal = pyqtSignal(int) + lineEndingsChangedSignal = pyqtSignal(int) + indentationTypeChangedSignal = pyqtSignal(int) + indentationSizeChangedSignal = pyqtSignal(int) + autoWrapChangedSignal = pyqtSignal(bool) + errorMarkersChangedSignal = pyqtSignal(bool) + errorAnnotationsChangedSignal = pyqtSignal(bool) + + def __init__(self, parent=None): + super(EditorPreferencesView, self).__init__(parent) + self.app_controller = None + + self.font = None + self.font_label = QLabel("Editor Font:") + self.font_choice = QLineEdit() + self.font_select = QPushButton("Select") + + self.encoding_label = QLabel("File Encoding:") + self.encoding_choice = QComboBox() + + self.line_endings_label = QLabel("Line Endings:") + self.line_endings_choice = QComboBox() + + self.indent_type_label = QLabel("Indentation using:") + self.indent_type_choice = QComboBox() + + self.indent_size_label = QLabel("Indentation Size:") + self.indent_size_choice = QSpinBox() + + self.wrap_choice = QCheckBox("Auto-wrap lines") + self.error_markers_choice = QCheckBox("Show error marker in margin of erroneous lines") + self.error_annotations_choice = QCheckBox("Show error annotations beneath erroneous lines") + + def initView(self): + self._initConnections() + self._initWidgets() + self._initLayout() + + def _initConnections(self): + self.font_select.clicked.connect(self._selectFont) + self.encoding_choice.activated.connect(self._encodingChanged) + self.line_endings_choice.activated.connect(self._lineEndingsChanged) + self.indent_type_choice.activated.connect(self._indentationTypeChanged) + self.indent_size_choice.valueChanged.connect(self._indentationSizeChanged) + self.wrap_choice.stateChanged.connect(self._autoWrapChanged) + self.error_markers_choice.stateChanged.connect(self._errorMarkersChanged) + self.error_annotations_choice.stateChanged.connect(self._errorAnnotationsChanged) + + def _initWidgets(self): + self.font_choice.setReadOnly(True) + self.font_choice.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + + self.encoding_choice.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.encoding_choice.addItem("UTF-8 (recommended)", Preferences.ENCODING_UTF8) + self.encoding_choice.addItem("ISO-8859-1 (Latin 1)", Preferences.ENCODING_LATIN1) + + self.line_endings_choice.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.line_endings_choice.addItem("LF (UNIX)", Preferences.LINE_ENDINGS_UNIX) + self.line_endings_choice.addItem("CR (Mac OS Classic)", Preferences.LINE_ENDINGS_MAC) + self.line_endings_choice.addItem("CRLF (Windows)", Preferences.LINE_ENDINGS_WINDOWS) + + self.indent_type_choice.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.indent_type_choice.addItem("Tabs", Preferences.INDENT_TAB) + self.indent_type_choice.addItem("Spaces", Preferences.INDENT_SPACES) + + # self.indent_size_choice.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.indent_size_choice.setMinimum(1) + + def _initLayout(self): + layout = QFormLayout() + layout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow) + layout.setContentsMargins(50, 12, 50, 20) + sublayout = QHBoxLayout() + sublayout.addWidget(self.font_choice) + sublayout.addWidget(self.font_select) + layout.addRow(self.font_label, sublayout) + layout.addRow(views.factory.ViewFactory.createLineSeparator()) + layout.addRow(self.encoding_label, self.encoding_choice) + layout.addRow(self.line_endings_label, self.line_endings_choice) + layout.addRow(views.factory.ViewFactory.createLineSeparator()) + layout.addRow(self.indent_type_label, self.indent_type_choice) + layout.addRow(self.indent_size_label, self.indent_size_choice) + layout.addRow(views.factory.ViewFactory.createLineSeparator()) + layout.addRow(self.wrap_choice) + layout.addRow(self.error_markers_choice) + layout.addRow(self.error_annotations_choice) + + self.setLayout(layout) + + 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) + + def _encodingChanged(self, index): + self.fileEncodingChangedSignal.emit(self.encoding_choice.itemData(index).toInt()[0]) + + def _lineEndingsChanged(self, index): + self.lineEndingsChangedSignal.emit(self.line_endings_choice.itemData(index).toInt()[0]) + + def _indentationTypeChanged(self, index): + self.indentationTypeChangedSignal.emit(self.indent_type_choice.itemData(index).toInt()[0]) + + def _indentationSizeChanged(self, value): + self.indentationSizeChangedSignal.emit(value) + + def _autoWrapChanged(self, state): + self.autoWrapChangedSignal.emit(state) + + def _errorMarkersChanged(self, state): + self.errorMarkersChangedSignal.emit(state) + + def _errorAnnotationsChanged(self, state): + self.errorAnnotationsChangedSignal.emit(state) + + @property + def editor_font(self): + return self.font + + @editor_font.setter + def editor_font(self, value): + self.font = value + if value is not None: + self.font_choice.setText("%s, %d pt." % (self.font.family(), self.font.pointSize())) + else: + self.font_choice.setText("") + + @property + def file_encoding(self): + return self.encoding_choice.itemData(self.encoding_choice.currentIndex()) + + @file_encoding.setter + def file_encoding(self, value): + self.encoding_choice.setCurrentIndex(self.encoding_choice.findData(value)) + + @property + def line_endings(self): + return self.line_endings_choice.itemData(self.line_endings_choice.currentIndex()) + + @line_endings.setter + def line_endings(self, value): + self.line_endings_choice.setCurrentIndex(self.line_endings_choice.findData(value)) + + @property + def indentation_type(self): + return self.indent_type_choice.itemData(self.indent_type_choice.currentIndex()) + + @indentation_type.setter + def indentation_type(self, value): + self.indent_type_choice.setCurrentIndex(self.indent_type_choice.findData(value)) + + @property + def indentation_size(self): + return self.indent_size_choice.value() + + @indentation_size.setter + def indentation_size(self, value): + self.indent_size_choice.setValue(value) + + @property + def auto_wrap(self): + return self.wrap_choice.isChecked() + + @auto_wrap.setter + def auto_wrap(self, value): + self.wrap_choice.setChecked(value) + + @property + def error_markers(self): + return self.error_markers_choice.isChecked() + + @error_markers.setter + def error_markers(self, value): + self.error_markers_choice.setChecked(value) + + @property + def error_annotations(self): + return self.error_annotations_choice.isChecked() + + @error_annotations.setter + def error_annotations(self, value): + self.error_annotations_choice.setChecked(value) \ No newline at end of file diff --git a/views/preferences/preview.py b/views/preferences/preview.py new file mode 100644 index 0000000..c359f72 --- /dev/null +++ b/views/preferences/preview.py @@ -0,0 +1,129 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from models import Preferences +import views.editor +import views.factory + +class PreviewPreferencesView(QWidget): + """ + The preview preferences view displays the user preferences for the previewing of + TikZ figures. + """ + + previewTemplateChangedSignal = pyqtSignal(unicode) + latexToPDFCommandChangedSignal = pyqtSignal(unicode) + PDFToImageCommandChangedSignal = pyqtSignal(unicode) + + def __init__(self, parent=None): + super(PreviewPreferencesView, self).__init__(parent) + self.app_controller = None + + self.preview_template_label = QLabel("LaTeX file template used for previewing the document:") + self.preview_template_button = QPushButton("Restore Default") + self.preview_template_editor = views.editor.EditorView() + self.preview_template_help = QLabel('Code placeholders: $PREAMBLE and $SOURCE') + + self.latex2pdf_label = QLabel("Command used for typesetting the LaTeX source to PDF:") + self.latex2pdf_button = QPushButton("Restore Default") + self.latex2pdf_text = QLineEdit() + self.latex2pdf_help = QLabel('Placeholders: $OUTPUT_DIR, $FILE_NAME and $FILE_PATH') + + self.pdf2image_label = QLabel("Command used for converting the PDF preview to image:") + self.pdf2image_button = QPushButton("Restore Default") + self.pdf2image_text = QLineEdit() + self.pdf2image_help = QLabel('Placeholders: $PDF_PATH and $IMAGE_PATH') + + def initView(self): + self._initConnections() + self._initWidgets() + self._initLayout() + + def _initConnections(self): + self.preview_template_editor.contentChangedSignal.connect(self._previewTemplateChanged) + self.latex2pdf_text.textChanged.connect(self._latex2pdfChanged) + self.pdf2image_text.textChanged.connect(self._pdf2imageChanged) + self.preview_template_button.clicked.connect(self._restoreDefaultPreviewTemplate) + self.latex2pdf_button.clicked.connect(self._restoreDefaultLatex2PDF) + self.pdf2image_button.clicked.connect(self._restoreDefaultPDF2Image) + + def _initWidgets(self): + self.preview_template_editor.initView(show_margin = False) + + def _initLayout(self): + layout = QGridLayout() + layout.addWidget(self.preview_template_label, 0, 0, 1, 3) + layout.addWidget(self.preview_template_editor, 1, 0, 1, 3) + layout.addWidget(self.preview_template_help, 2, 0, 1, 2) + layout.addWidget(self.preview_template_button, 2, 2) + layout.addWidget(views.factory.ViewFactory.createLineSeparator(), 3, 0, 1, 3) + layout.addWidget(self.latex2pdf_label, 4, 0, 1, 3) + layout.addWidget(self.latex2pdf_text, 5, 0, 1, 3) + layout.addWidget(self.latex2pdf_help, 6, 0, 1, 2) + layout.addWidget(self.latex2pdf_button, 6, 2) + layout.addWidget(views.factory.ViewFactory.createLineSeparator(), 7, 0, 1, 3) + layout.addWidget(self.pdf2image_label, 8, 0, 1, 3) + layout.addWidget(self.pdf2image_text, 9, 0, 1, 3) + layout.addWidget(self.pdf2image_help, 10, 0, 1, 2) + layout.addWidget(self.pdf2image_button, 10, 2) + self.setLayout(layout) + + @property + def preview_template(self): + return self.preview_template_editor.content + + @preview_template.setter + def preview_template(self, value): + self.preview_template_editor.content = value + + @property + def latex_to_pdf_command(self): + return self.latex2pdf_text.text() + + @latex_to_pdf_command.setter + def latex_to_pdf_command(self, value): + self.latex2pdf_text.setText(value) + self.latex2pdf_text.setCursorPosition(0) + + @property + def pdf_to_image_command(self): + return self.pdf2image_text.text() + + @pdf_to_image_command.setter + def pdf_to_image_command(self, value): + self.pdf2image_text.setText(value) + self.pdf2image_text.setCursorPosition(0) + + def _restoreDefaultPreviewTemplate(self): + self.preview_template_editor.content = Preferences.defaultPreviewTemplate() + + def _restoreDefaultLatex2PDF(self): + self.latex2pdf_text.setText(Preferences.defaultLatexToPDFCommand()) + + def _restoreDefaultPDF2Image(self): + self.pdf2image_text.setText(Preferences.defaultPDFToImageCommand()) + + def _previewTemplateChanged(self): + self.previewTemplateChangedSignal.emit(self.preview_template) + + def _latex2pdfChanged(self): + self.latexToPDFCommandChangedSignal.emit(self.latex_to_pdf_command) + + def _pdf2imageChanged(self): + self.PDFToImageCommandChangedSignal.emit(self.pdf_to_image_command) \ No newline at end of file diff --git a/views/preferences/snippets.py b/views/preferences/snippets.py new file mode 100644 index 0000000..445f17b --- /dev/null +++ b/views/preferences/snippets.py @@ -0,0 +1,255 @@ +# Copyright 2012 (C) Mickael Menu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +from tools import isMacintoshComputer +from tools.qt import Dialogs +from models import Preferences +import views.editor +import views.factory + +class EditSnippetView(QDialog): + """ + Dialog for editing a snippet. + """ + + def __init__(self, parent, snippets_view, name=None, code=None): + super(EditSnippetView, self).__init__(parent) + self.old_name = name + self.old_code = code + self.snippets_view = snippets_view + self.name_label = QLabel("Name:") + self.name_edit = QLineEdit() + self.code_label = QLabel("Code:") + self.code_edit = views.editor.EditorView() + self.code_help = QLabel('Cursor position placeholder: @@@') + self.cancel_button = QPushButton("Cancel") + self.ok_button = QPushButton("OK") + self.initDialog() + + def dialogTitle(self): + return "Edit Snippet" + + @property + def name(self): + return unicode(self.name_edit.text()) + + @name.setter + def name(self, name): + self.name_edit.setText(name) + + @property + def code(self): + return unicode(self.code_edit.content) + + @code.setter + def code(self, code): + self.code_edit.content = code + + def initDialog(self): + self.name = self.old_name + self.code = self.old_code + self.setWindowTitle(self.dialogTitle()) + if isMacintoshComputer(): + self.setWindowFlags(Qt.Sheet) + else: + self.setModal(True) + self._initConnections() + self._initWidgets() + self._initLayout() + + def _initConnections(self): + self.cancel_button.clicked.connect(self._cancelClicked) + self.ok_button.clicked.connect(self._okClicked) + + def _initWidgets(self): + self.code_edit.initView(show_margin = False) + self.ok_button.setDefault(True) + + def _initLayout(self): + layout = QVBoxLayout() + layout.addWidget(self.name_label) + layout.addWidget(self.name_edit) + layout.addWidget(self.code_label) + layout.addWidget(self.code_edit) + layout.addWidget(self.code_help) + sublayout = QHBoxLayout() + sublayout.addWidget(self.cancel_button, 1, Qt.AlignRight) + sublayout.addWidget(self.ok_button, 0, Qt.AlignRight) + layout.addLayout(sublayout) + self.setLayout(layout) + + 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.old_name != self.name and self.name in snippets: + Dialogs.showError("A snippet with the same name already exists") + else: + if self.old_name != self.name: + del snippets[self.old_name] + snippets[self.name] = self.code + self.snippets_view.snippets = snippets + self.snippets_view.snippetsChangedSignal.emit(snippets) + self.close() + + def _cancelClicked(self): + self.close() + + +class AddSnippetView(EditSnippetView): + """ + Dialog for adding a snippet. + """ + + def __init__(self, parent, snippets_view): + super(AddSnippetView, self).__init__(parent, snippets_view, u"Untitled", u"") + + def dialogTitle(self): + return "Add Snippet" + + 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() + +class SnippetsPreferencesView(QWidget): + """ + The snippets preferences view displays the user preferences for the editor snippets. + """ + + snippetsChangedSignal = pyqtSignal(dict) + + def __init__(self, parent=None): + super(SnippetsPreferencesView, self).__init__(parent) + self.app_controller = None + + self.snippets_label = QLabel("Code Snippets:") + self.snippets_list = QTreeWidget() + self.reset_button = QPushButton("Restore All Snippets") + self.add_button = QPushButton("Add") + self.remove_button = QPushButton("Remove") + self.edit_button = QPushButton("Edit") + self._snippets = {} + + def initView(self): + self._initConnections() + self._initWidgets() + self._initLayout() + + def _initConnections(self): + self.snippets_list.itemDoubleClicked.connect(self._snippetDoubleClicked) + self.reset_button.clicked.connect(self._restoreAllSnippets) + self.add_button.clicked.connect(self._addSnippet) + self.remove_button.clicked.connect(self._removeSnippet) + self.edit_button.clicked.connect(self._editSnippet) + + def _initWidgets(self): + self.snippets_list.setMinimumHeight(350) + self.snippets_list.setColumnCount(2) + self.snippets_list.setHeaderLabels(["Name", "Code"]) + self.snippets_list.setSortingEnabled(True) + self.snippets_list.sortByColumn(0, Qt.AscendingOrder) + self.snippets_list.setSelectionBehavior(QTreeWidget.SelectRows) + self.snippets_list.setSelectionMode(QTreeWidget.ExtendedSelection) + + def _initLayout(self): + layout = QVBoxLayout() + layout.addWidget(self.snippets_label) + layout.addWidget(self.snippets_list) + sublayout = QHBoxLayout() + sublayout.addWidget(self.add_button, 0, Qt.AlignLeft) + sublayout.addWidget(self.remove_button, 0, Qt.AlignLeft) + sublayout.addWidget(self.edit_button, 0, Qt.AlignLeft) + sublayout.addWidget(self.reset_button, 1, Qt.AlignRight) + layout.addLayout(sublayout) + self.setLayout(layout) + + 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") + + 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") + + @property + def selected_snippets(self): + selected_snippets = [] + items = self.snippets_list.selectedItems() + for item in items: + selected_snippets.append(unicode(item.data(0, Qt.DisplayRole).toString())) + return selected_snippets + + @property + def snippets(self): + return self._snippets + + @snippets.setter + def snippets(self, snippets): + self._snippets = snippets + self._updateSnippetsListView() + + def _updateSnippetsListView(self): + self.snippets_list.clear() + if self.snippets is not None: + items = [] + for (name, code) in self.snippets.items(): + code = code.replace('\n', ' ') + item = QTreeWidgetItem([name, code]) + item.setData(0, Qt.DisplayRole, name) + items.append(item) + self.snippets_list.insertTopLevelItems(0, items) + + def _snippetDoubleClicked(self, item, column): + self.editSnippet(unicode(item.data(0, Qt.DisplayRole).toString())) + + def _restoreAllSnippets(self): + self.snippets = Preferences.defaultSnippets() + self.snippetsChangedSignal.emit(self.snippets) + + def _addSnippet(self): + dialog = AddSnippetView(self.parent(), self) + dialog.show() + + def _removeSnippet(self): + for snippet in self.selected_snippets: + self.removeSnippet(snippet) + + def _editSnippet(self): + selected_snippets = self.selected_snippets + if len(selected_snippets) > 0: + self.editSnippet(selected_snippets[0]) \ No newline at end of file