Henning Schröder avatar Henning Schröder committed fc2ca24

setuptools support

Comments (0)

Files changed (5)

excepthook/Makefile

-PYUIC=pyuic4
-UI_FILES=$(shell ls *.ui 2>/dev/null)
-UI_COMPILED=$(UI_FILES:.ui=_ui.py)
-
-all: $(UI_COMPILED)
-
-%_ui.py:%.ui
-	$(PYUIC) -x -o "$@" "$<"
-
-
-clean:
-	rm -f $(FORMS) *~ *.pyc

excepthook/__init__.py

-"""
-Exception hook
-If some unexpected error occures it can be shown in a nice looking dialog.
-Especially useful is the traceback view.
-
-Things to extend: Clicking on the filename should open an editor.
-Things to consider: Mail exceptions, copy to clipboard or send to bug tracker.
-"""
-import sys
-import cgitb
-import atexit
-
-from PyQt4.QtCore import pyqtSignature, Qt
-from PyQt4.QtGui import QDialog, QApplication
-
-from excepthook_ui import Ui_ExceptHookDialog
-
-import warnings
-warnings.filterwarnings(
-  action='ignore',
-  message='BaseException.message has been deprecated as of Python 2.6',
-  category=DeprecationWarning,
-  module='cgitb')
-                                    
-
-
-def on_error(exc_type, exc_obj, exc_tb):
-    """
-    This is the callback function for sys.excepthook
-    """
-    dlg = ExceptHookDialog(exc_type, exc_obj, exc_tb)
-    dlg.show()
-    dlg.exec_()
-
-
-
-def show_current_error(title=None):
-    """
-    Call this function to show the current error.
-    It can be used inside an except-block.
-    """
-    dlg = ExceptHookDialog(sys.exc_type, sys.exc_value, sys.exc_traceback, title)
-    dlg.show()
-    dlg.exec_()
-
-
-def install():
-    "activates the error handler"
-    sys.excepthook = on_error
-
-
-    
-def uninstall():
-    "removes the error handler"
-    sys.excepthook = sys.__excepthook__
-
-atexit.register(uninstall)
-
-
-class ExceptHookDialog(QDialog):
-
-
-    def __init__(self, exc_type, exc_obj, exc_tb, title=None):
-        QDialog.__init__(self)
-        self.ui = Ui_ExceptHookDialog()
-        self.ui.setupUi(self)
-        if title:
-            self.setWindowTitle(self.windowTitle() + ": " + title)
-        self.ui.detailsButton.setCheckable(True)
-        self.setExtension(self.ui.tracebackBrowser)
-        self.setOrientation(Qt.Vertical)
-        msg = "%s: %s" % (exc_type.__name__, exc_obj)
-        self.ui.exceptionLabel.setText(msg)
-        html = cgitb.html((exc_type, exc_obj, exc_tb))
-        self.ui.tracebackBrowser.setText(html)
-        self.resize(self.sizeHint())
-
-
-    @pyqtSignature("")
-    def on_closeButton_clicked(self):
-        self.close()
-
-
-    @pyqtSignature("")
-    def on_detailsButton_clicked(self):
-        self.showExtension(self.ui.detailsButton.isChecked())
-
-
-
-if __name__ == "__main__":
-    # Some tests:
-    app = QApplication(sys.argv)
-    install()
-    print "Triggering error 1"
-    try:
-        fail = 1 / 0
-    except:
-        show_current_error("Using inside except")
-    print "Triggering error 2"
-    fail2 = 1 / 0
-    print "This will never be reached because excepthook"
-    print "complains about fail2"

excepthook/excepthook.ui

-<ui version="4.0" >
- <class>ExceptHookDialog</class>
- <widget class="QDialog" name="ExceptHookDialog" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>542</width>
-    <height>290</height>
-   </rect>
-  </property>
-  <property name="windowTitle" >
-   <string>Script error</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout" >
-   <item>
-    <layout class="QGridLayout" name="gridLayout" >
-     <property name="spacing" >
-      <number>10</number>
-     </property>
-     <item row="0" column="0" >
-      <widget class="QLabel" name="label" >
-       <property name="text" >
-        <string>An exception occured while running the script.</string>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1" >
-      <widget class="QPushButton" name="closeButton" >
-       <property name="text" >
-        <string>&amp;Close</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0" >
-      <widget class="QLabel" name="exceptionLabel" >
-       <property name="font" >
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
-       <property name="text" >
-        <string>Exception</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1" >
-      <widget class="QPushButton" name="detailsButton" >
-       <property name="text" >
-        <string>&amp;Details >></string>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <widget class="QTextBrowser" name="tracebackBrowser" >
-     <property name="minimumSize" >
-      <size>
-       <width>0</width>
-       <height>200</height>
-      </size>
-     </property>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

excepthook/excepthook_ui.py

-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'excepthook.ui'
-#
-# Created: Thu Aug 19 20:48:19 2010
-#      by: PyQt4 UI code generator 4.7.2
-#
-# WARNING! All changes made in this file will be lost!
-
-from PyQt4 import QtCore, QtGui
-
-class Ui_ExceptHookDialog(object):
-    def setupUi(self, ExceptHookDialog):
-        ExceptHookDialog.setObjectName("ExceptHookDialog")
-        ExceptHookDialog.resize(542, 290)
-        self.verticalLayout = QtGui.QVBoxLayout(ExceptHookDialog)
-        self.verticalLayout.setObjectName("verticalLayout")
-        self.gridLayout = QtGui.QGridLayout()
-        self.gridLayout.setSpacing(10)
-        self.gridLayout.setObjectName("gridLayout")
-        self.label = QtGui.QLabel(ExceptHookDialog)
-        self.label.setObjectName("label")
-        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
-        self.closeButton = QtGui.QPushButton(ExceptHookDialog)
-        self.closeButton.setObjectName("closeButton")
-        self.gridLayout.addWidget(self.closeButton, 0, 1, 1, 1)
-        self.exceptionLabel = QtGui.QLabel(ExceptHookDialog)
-        font = QtGui.QFont()
-        font.setWeight(75)
-        font.setBold(True)
-        self.exceptionLabel.setFont(font)
-        self.exceptionLabel.setObjectName("exceptionLabel")
-        self.gridLayout.addWidget(self.exceptionLabel, 1, 0, 1, 1)
-        self.detailsButton = QtGui.QPushButton(ExceptHookDialog)
-        self.detailsButton.setObjectName("detailsButton")
-        self.gridLayout.addWidget(self.detailsButton, 1, 1, 1, 1)
-        self.verticalLayout.addLayout(self.gridLayout)
-        self.tracebackBrowser = QtGui.QTextBrowser(ExceptHookDialog)
-        self.tracebackBrowser.setMinimumSize(QtCore.QSize(0, 200))
-        self.tracebackBrowser.setObjectName("tracebackBrowser")
-        self.verticalLayout.addWidget(self.tracebackBrowser)
-
-        self.retranslateUi(ExceptHookDialog)
-        QtCore.QMetaObject.connectSlotsByName(ExceptHookDialog)
-
-    def retranslateUi(self, ExceptHookDialog):
-        ExceptHookDialog.setWindowTitle(QtGui.QApplication.translate("ExceptHookDialog", "Script error", None, QtGui.QApplication.UnicodeUTF8))
-        self.label.setText(QtGui.QApplication.translate("ExceptHookDialog", "An exception occured while running the script.", None, QtGui.QApplication.UnicodeUTF8))
-        self.closeButton.setText(QtGui.QApplication.translate("ExceptHookDialog", "&Close", None, QtGui.QApplication.UnicodeUTF8))
-        self.exceptionLabel.setText(QtGui.QApplication.translate("ExceptHookDialog", "Exception", None, QtGui.QApplication.UnicodeUTF8))
-        self.detailsButton.setText(QtGui.QApplication.translate("ExceptHookDialog", "&Details >>", None, QtGui.QApplication.UnicodeUTF8))
-
-
-if __name__ == "__main__":
-    import sys
-    app = QtGui.QApplication(sys.argv)
-    ExceptHookDialog = QtGui.QDialog()
-    ui = Ui_ExceptHookDialog()
-    ui.setupUi(ExceptHookDialog)
-    ExceptHookDialog.show()
-    sys.exit(app.exec_())
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from setuptools import setup, find_packages
+
+if __name__ == "__main__":
+    setup(
+        name = "codeaide",
+        version = "0.1",
+        description="Source Code Editor Widget for PyQt4",
+        author="Henning Schroeder",
+        author_email="henning.schroeder@gmail.com",
+        zip_safe=True,
+        license="GPL2",
+        keywords="pyqt pyqt4 editor widget qplaintextedit qsyntaxhighlighter",
+        packages = find_packages(),
+    )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.