Changeset 745

Show
Ignore:
Timestamp:
07/25/08 10:53:01 (4 months ago)
Author:
sylvain
Message:

Largely extended atom support by implementing the author, link and category models.
Started looking at adding a browser for localisation purpose

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • oss/jlib/designer/ui/atomentryform.ui

    r737 r745  
    1717    <widget class="QToolBox" name="toolBox" > 
    1818     <property name="currentIndex" > 
    19       <number>0</number> 
     19      <number>5</number> 
    2020     </property> 
    2121     <widget class="QWidget" name="generalItem" > 
     
    7878         <property name="sizeHint" stdset="0" > 
    7979          <size> 
    80            <width>268</width> 
     80           <width>259</width> 
    8181           <height>20</height> 
    8282          </size> 
     
    122122        <y>0</y> 
    123123        <width>497</width> 
    124         <height>271</height> 
     124        <height>243</height> 
    125125       </rect> 
    126126      </property> 
     
    144144        <y>0</y> 
    145145        <width>497</width> 
    146         <height>271</height> 
     146        <height>243</height> 
    147147       </rect> 
    148148      </property> 
     
    181181       <item> 
    182182        <widget class="QTextEdit" name="content" /> 
     183       </item> 
     184      </layout> 
     185     </widget> 
     186     <widget class="QWidget" name="page" > 
     187      <attribute name="label" > 
     188       <string>Page</string> 
     189      </attribute> 
     190      <layout class="QGridLayout" name="gridLayout_2" > 
     191       <item row="0" column="0" > 
     192        <widget class="QWebView" name="browser" > 
     193         <property name="url" > 
     194          <url> 
     195           <string>about:blank</string> 
     196          </url> 
     197         </property> 
     198        </widget> 
    183199       </item> 
    184200      </layout> 
     
    195211  </layout> 
    196212 </widget> 
     213 <customwidgets> 
     214  <customwidget> 
     215   <class>QWebView</class> 
     216   <extends>QWidget</extends> 
     217   <header>QtWebKit/QWebView</header> 
     218  </customwidget> 
     219 </customwidgets> 
    197220 <resources/> 
    198221 <connections/> 
  • oss/jlib/jlib/core/atom.py

    r728 r745  
    88from PyQt4 import QtCore, QtGui 
    99 
    10 __all__ = ['jlibAtomAuthorItem', 'jlibAtomAuthorModel',  
    11            'jlibAtomLinkItem', 'jlibAtomLinkModel'] 
     10__all__ = ['jlibAtomAuthorItem', 'jlibAtomAuthorModel', 
     11           'jlibAtomAuthorItemDelegate', 
     12           'jlibAtomLinkItem', 'jlibAtomLinkModel', 
     13           'jlibAtomLinkItemDelegate', 
     14           'jlibAtomCategoryItem', 'jlibAtomCategoryModel', 
     15           'jlibAtomCategoryItemDelegate'] 
    1216 
    1317class jlibAtomAuthorItem(QtGui.QStandardItem): 
     
    1822    def type(self): 
    1923        return QtGui.QStandardItem.UserType + 120 
     24 
     25    def get_name(self): 
     26        author_name = self.author.get_child('name', ATOM10_NS) 
     27        if author_name: 
     28            return unicode(author_name) 
     29 
     30        return u'' 
     31 
     32    def set_name(self, name): 
     33        author_name = self.author.get_child('name', ATOM10_NS) 
     34        if author_name: 
     35            author_name.xml_text = name or u'' 
     36        else: 
     37            E(u'name', namespace=ATOM10_NS, prefix=self.author.xml_prefix, 
     38              content=name or u'', parent=self.author) 
     39    name = property(get_name, set_name) 
     40 
     41    def get_uri(self): 
     42        author_uri = self.author.get_child('uri', ATOM10_NS) 
     43        if author_uri: 
     44            return unicode(author_uri) 
     45 
     46        return u'' 
     47     
     48    def set_uri(self, uri): 
     49        author_uri = self.author.get_child('uri', ATOM10_NS) 
     50        if author_uri: 
     51            author_uri.xml_text = uri or u'' 
     52        else: 
     53            E(u'uri', namespace=ATOM10_NS, prefix=self.author.xml_prefix, 
     54              content=uri or u'', parent=self.author) 
     55    uri = property(get_uri, set_uri) 
     56 
     57    def get_email(self): 
     58        author_email = self.author.get_child('email', ATOM10_NS) 
     59        if author_email: 
     60            return unicode(author_email) 
     61 
     62        return u'' 
     63     
     64    def set_email(self, email): 
     65        author_email = self.author.get_child('email', ATOM10_NS) 
     66        if author_email: 
     67            author_email.xml_text = email or u'' 
     68        else: 
     69            E(u'email', namespace=ATOM10_NS, prefix=self.author.xml_prefix, 
     70              content=email or u'', parent=self.author) 
     71    email = property(get_email, set_email) 
    2072     
    2173class jlibAtomAuthorModel(QtGui.QStandardItemModel): 
     
    2577        self.setHeaderData(1, QtCore.Qt.Horizontal, QtCore.QVariant("Email")) 
    2678        self.setHeaderData(2, QtCore.Qt.Horizontal, QtCore.QVariant("URI")) 
    27         self.authors = {} 
    2879 
    2980    def setAuthors(self, authors): 
     
    3182            self.setAuthor(author) 
    3283 
    33     def getAuthorIndex(self, author): 
    34         author_name = author.get_child('name', ATOM10_NS) 
    35         if author_name and str(author_name) in self.authors: 
    36             return self.authors[str(author_name)].index() 
    37  
    38         return QtCore.QModelIndex() 
    39  
    40     def getAuthorItem(self, index): 
    41         return self.itemFromIndex(index) 
    42  
    4384    def setAuthor(self, author): 
    4485        rootItem = self.invisibleRootItem() 
    45  
    46         author_name = author.get_child('name', ATOM10_NS) 
    47  
    48         index = self.getAuthorIndex(author) 
     86        row = self.rowCount() 
     87 
     88        for i in range(0, 3): 
     89            item = jlibAtomAuthorItem(author) 
     90            if i == 0: 
     91                item.setData(QtCore.QVariant(QtCore.QString(item.name)), 
     92                             QtCore.Qt.DisplayRole) 
     93            elif i == 1: 
     94                item.setData(QtCore.QVariant(QtCore.QString(item.email)), 
     95                             QtCore.Qt.DisplayRole) 
     96            elif i == 2: 
     97                item.setData(QtCore.QVariant(QtCore.QString(item.uri)), 
     98                             QtCore.Qt.DisplayRole) 
     99            self.setItem(row, i, item) 
     100 
     101    def removeAuthor(self, index): 
    49102        if index.isValid(): 
    50             item = self.authors[str(author_name)] 
    51         else: 
     103            item = self.itemFromIndex(index) 
     104            item.author.forget() 
     105            self.removeRow(index.row()) 
     106             
     107    def newAuthor(self, author): 
     108        row = self.rowCount() 
     109 
     110        for i in range(0, 3): 
    52111            item = jlibAtomAuthorItem(author) 
    53          
    54         rootItem.appendRow(item) 
    55  
    56         self.setData(self.index(item.row(), 0), 
    57                      QtCore.QVariant(QtCore.QString(author_name.xml_text or '')), 
    58                      QtCore.Qt.DisplayRole) 
    59  
    60         author_email = author.get_child('email', ATOM10_NS) 
    61         if author_email and author_email.xml_text: 
    62             self.setData(self.index(item.row(), 1), 
    63                          QtCore.QVariant(QtCore.QString(str(author_email))), 
    64                          QtCore.Qt.DisplayRole) 
    65  
    66         author_uri = author.get_child('uri', ATOM10_NS) 
    67         if author_uri and author_uri.xml_text: 
    68             self.setData(self.index(item.row(), 2), 
    69                          QtCore.QVariant(QtCore.QString(str(author_uri))), 
    70                          QtCore.Qt.DisplayRole) 
    71  
    72         self.authors[str(author_name)] = item 
    73  
    74         return item 
     112            self.setItem(row, i, item) 
     113 
     114class jlibAtomAuthorItemDelegate(QtGui.QItemDelegate): 
     115    def __init__(self, parent=None): 
     116        QtGui.QItemDelegate.__init__(self, parent) 
     117 
     118    def createEditor(self, parent, option, index): 
     119        editor = QtGui.QLineEdit(parent) 
     120        editor.installEventFilter(self) 
     121        return editor 
     122 
     123    def setEditorData(self, editor, index): 
     124        value = index.model().data(index, QtCore.Qt.DisplayRole).toString() 
     125        editor.setText(value) 
     126 
     127    def setModelData(self, editor, model, index): 
     128        item = model.itemFromIndex(index) 
     129        if index.column() == 0: 
     130            item.name = unicode(editor.text()) 
     131        elif index.column() == 1: 
     132            item.email = unicode(editor.text()) 
     133        elif index.column() == 2: 
     134            item.uri = unicode(editor.text()) 
     135        model.setData(index, QtCore.QVariant(editor.text())) 
     136 
     137    def updateEditorGeometry(self, editor, option, index): 
     138        editor.setGeometry(option.rect) 
    75139 
    76140class jlibAtomLinkItem(QtGui.QStandardItem): 
     
    80144 
    81145    def type(self): 
    82         return QtGui.QStandardItem.UserType + 120 
    83  
    84     @property 
    85     def uri(self): 
    86         return self.link.get_attribute_value('href') 
    87      
    88     @property 
    89     def relation(self): 
    90         return self.link.get_attribute_value('rel') 
    91      
    92     @property 
    93     def title(self): 
    94         return self.link.get_attribute_value('title') 
    95      
    96     @property 
    97     def mime_type(self): 
    98         return self.link.get_attribute_value('type') 
     146        return QtGui.QStandardItem.UserType + 121 
     147 
     148    def get_uri(self): 
     149        return self.link.get_attribute_value('href', '') 
     150 
     151    def set_uri(self, uri): 
     152        self.link.set_attribute_value('href', uri) 
     153    uri = property(get_uri, set_uri) 
     154     
     155    def get_relation(self): 
     156        return self.link.get_attribute_value('rel', '') 
     157 
     158    def set_relation(self, rel): 
     159        self.link.set_attribute_value('rel', rel) 
     160    rel = property(get_relation, set_relation) 
     161     
     162    def get_title(self): 
     163        return self.link.get_attribute_value('title', '') 
     164 
     165    def set_title(self, title): 
     166        self.link.set_attribute_value('title', title) 
     167    title = property(get_title, set_title) 
     168     
     169    def get_mime_type(self): 
     170        return self.link.get_attribute_value('type', '') 
     171 
     172    def set_mime_type(self, mime_type): 
     173        self.link.set_attribute_value('type', mime_type) 
     174    mime_type = property(get_mime_type, set_mime_type) 
    99175     
    100176class jlibAtomLinkModel(QtGui.QStandardItemModel): 
     
    105181        self.setHeaderData(2, QtCore.Qt.Horizontal, QtCore.QVariant("URI")) 
    106182        self.setHeaderData(3, QtCore.Qt.Horizontal, QtCore.QVariant("Type")) 
    107         self.links = {} 
    108183 
    109184    def setLinks(self, links): 
     
    111186            self.setLink(link) 
    112187 
    113     def getLinkIndex(self, link): 
    114         uri = link.get_attribute_value('href') 
    115         if uri and uri in self.links: 
    116             return self.links[uri].index() 
    117  
    118         return QtCore.QModelIndex() 
    119  
    120     def getLinkItem(self, index): 
    121         return self.itemFromIndex(index) 
    122  
    123188    def setLink(self, link): 
    124189        rootItem = self.invisibleRootItem() 
    125  
    126         uri = link.get_attribute_value('href') 
    127  
    128         index = self.getLinkIndex(link) 
     190        row = self.rowCount() 
     191 
     192        for i in range(0, 4): 
     193            item = jlibAtomLinkItem(link) 
     194            if i == 0: 
     195                item.setData(QtCore.QVariant(QtCore.QString(item.title)), 
     196                             QtCore.Qt.DisplayRole) 
     197            elif i == 1: 
     198                item.setData(QtCore.QVariant(QtCore.QString(item.rel)), 
     199                             QtCore.Qt.DisplayRole) 
     200            elif i == 2: 
     201                item.setData(QtCore.QVariant(QtCore.QString(item.uri)), 
     202                             QtCore.Qt.DisplayRole) 
     203            elif i == 3: 
     204                item.setData(QtCore.QVariant(QtCore.QString(item.mime_type)), 
     205                             QtCore.Qt.DisplayRole) 
     206            self.setItem(row, i, item) 
     207 
     208    def removeLink(self, index): 
    129209        if index.isValid(): 
    130             item = self.links[uri] 
    131         else: 
     210            item = self.itemFromIndex(index) 
     211            item.link.forget() 
     212            self.removeRow(index.row()) 
     213             
     214    def newLink(self, link): 
     215        row = self.rowCount() 
     216 
     217        for i in range(0, 4): 
    132218            item = jlibAtomLinkItem(link) 
    133          
    134         rootItem.appendRow(item) 
    135  
    136         self.setData(self.index(item.row(), 2), 
    137                      QtCore.QVariant(QtCore.QString(uri or '')), 
    138                      QtCore.Qt.DisplayRole) 
    139  
    140         title = item.title 
    141         if title: 
    142             self.setData(self.index(item.row(), 0), 
    143                          QtCore.QVariant(QtCore.QString(title)), 
    144                          QtCore.Qt.DisplayRole) 
    145  
    146         rel = item.relation 
    147         if rel: 
    148             self.setData(self.index(item.row(), 1), 
    149                          QtCore.QVariant(QtCore.QString(rel)), 
    150                          QtCore.Qt.DisplayRole) 
    151  
    152         mime_type = item.mime_type 
    153         if mime_type: 
    154             self.setData(self.index(item.row(), 3), 
    155                          QtCore.QVariant(QtCore.QString(mime_type)), 
    156                          QtCore.Qt.DisplayRole) 
    157  
    158         self.links[uri] = item 
    159  
    160         return item 
     219            self.setItem(row, i, item) 
     220 
     221class jlibAtomLinkItemDelegate(QtGui.QItemDelegate): 
     222    def __init__(self, parent=None): 
     223        QtGui.QItemDelegate.__init__(self, parent) 
     224 
     225    def createEditor(self, parent, option, index): 
     226        editor = QtGui.QLineEdit(parent) 
     227        editor.installEventFilter(self) 
     228        return editor 
     229 
     230    def setEditorData(self, editor, index): 
     231        value = index.model().data(index, QtCore.Qt.DisplayRole).toString() 
     232        editor.setText(value) 
     233 
     234    def setModelData(self, editor, model, index): 
     235        item = model.itemFromIndex(index) 
     236        if index.column() == 0: 
     237            item.title = unicode(editor.text()) 
     238        elif index.column() == 1: 
     239            item.rel = unicode(editor.text()) 
     240        elif index.column() == 2: 
     241            item.uri = unicode(editor.text()) 
     242        elif index.column() == 3: 
     243            item.mime_type = unicode(editor.text()) 
     244        model.setData(index, QtCore.QVariant(editor.text())) 
     245 
     246    def updateEditorGeometry(self, editor, option, index): 
     247        editor.setGeometry(option.rect) 
     248 
     249 
     250class jlibAtomCategoryItem(QtGui.QStandardItem): 
     251    def __init__(self, category): 
     252        QtGui.QStandardItem.__init__(self) 
     253        self.category = category 
     254 
     255    def type(self): 
     256        return QtGui.QStandardItem.UserType + 122 
     257 
     258    def get_scheme(self): 
     259        return self.category.get_attribute_value('scheme', '') 
     260 
     261    def set_scheme(self, scheme): 
     262        self.category.set_attribute_value('scheme', scheme) 
     263    scheme = property(get_scheme, set_scheme) 
     264     
     265    def get_term(self): 
     266        return self.category.get_attribute_value('term', '') 
     267 
     268    def set_term(self, term): 
     269        self.category.set_attribute_value('term', term) 
     270    term = property(get_term, set_term) 
     271     
     272    def get_label(self): 
     273        return self.category.get_attribute_value('label', '') 
     274 
     275    def set_label(self, label): 
     276        self.category.set_attribute_value('label', label) 
     277    label = property(get_label, set_label) 
     278 
     279class jlibAtomCategoryModel(QtGui.QStandardItemModel): 
     280    def __init__(self, parent=None): 
     281        QtGui.QStandardItemModel.__init__(self, 0, 3, parent) 
     282        self.setHeaderData(0, QtCore.Qt.Horizontal, QtCore.QVariant("Label")) 
     283        self.setHeaderData(1, QtCore.Qt.Horizontal, QtCore.QVariant("Term")) 
     284        self.setHeaderData(2, QtCore.Qt.Horizontal, QtCore.QVariant("Scheme")) 
     285 
     286    def setCategories(self, categories): 
     287        for category in categories: 
     288            self.setCategory(category) 
     289 
     290    def setCategory(self, category): 
     291        rootItem = self.invisibleRootItem() 
     292        row = self.rowCount() 
     293 
     294        for i in range(0, 3): 
     295            item = jlibAtomCategoryItem(category) 
     296            if i == 0: 
     297                item.setData(QtCore.QVariant(QtCore.QString(item.label)), 
     298                             QtCore.Qt.DisplayRole) 
     299            elif i == 1: 
     300                item.setData(QtCore.QVariant(QtCore.QString(item.term)), 
     301                             QtCore.Qt.DisplayRole) 
     302            elif i == 2: 
     303                item.setData(QtCore.QVariant(QtCore.QString(item.scheme)), 
     304                             QtCore.Qt.DisplayRole) 
     305            self.setItem(row, i, item) 
     306 
     307    def removeCategory(self, index): 
     308        if index.isValid(): 
     309            item = self.itemFromIndex(index) 
     310            item.category.forget() 
     311            self.removeRow(index.row()) 
     312             
     313    def newCategory(self, category): 
     314        row = self.rowCount() 
     315 
     316        for i in range(0, 3): 
     317            item = jlibAtomCategoryItem(category) 
     318            self.setItem(row, i, item) 
     319 
     320class jlibAtomCategoryItemDelegate(QtGui.QItemDelegate): 
     321    def __init__(self, parent=None): 
     322        QtGui.QItemDelegate.__init__(self, parent) 
     323 
     324    def createEditor(self, parent, option, index): 
     325        editor = QtGui.QLineEdit(parent) 
     326        editor.installEventFilter(self) 
     327        return editor 
     328 
     329    def setEditorData(self, editor, index): 
     330        value = index.model().data(index, QtCore.Qt.DisplayRole).toString() 
     331        editor.setText(value) 
     332 
     333    def setModelData(self, editor, model, index): 
     334        item = model.itemFromIndex(index) 
     335        if index.column() == 0: 
     336            item.label = unicode(editor.text()) 
     337        elif index.column() == 1: 
     338            item.term = unicode(editor.text()) 
     339        elif index.column() == 2: 
     340            item.scheme = unicode(editor.text()) 
     341        model.setData(index, QtCore.QVariant(editor.text())) 
     342 
     343    def updateEditorGeometry(self, editor, option, index): 
     344        editor.setGeometry(option.rect) 
     345 
     346     
  • oss/jlib/jlib/gui/atom/entry.py

    r742 r745  
    11# -*- coding: utf-8 -*- 
    22import datetime 
    3 from PyQt4 import QtCore, QtGui 
     3from PyQt4 import QtCore, QtGui, QtNetwork 
    44 
    55from bridge import Element as E 
     
    77 
    88from jlib.gui.atom.entryui import Ui_jlibAtomEntryForm 
    9 from jlib.core.atom import jlibAtomAuthorModel, jlibAtomLinkModel 
     9from jlib.core.atom import jlibAtomAuthorModel, jlibAtomLinkModel,\ 
     10     jlibAtomAuthorItemDelegate, jlibAtomLinkItemDelegate, \ 
     11     jlibAtomCategoryModel, jlibAtomCategoryItemDelegate 
    1012 
    1113__all__ = ['jlibAtomEntryForm', 'jlibAtomEntryFormDialog'] 
     
    2022    def setupUi(self, parent): 
    2123        Ui_jlibAtomEntryForm.setupUi(self, parent) 
     24         
    2225        self.authors.contextMenuEvent = self.authorsContextMenuEvent 
     26        author_delegate = jlibAtomAuthorItemDelegate(parent=self) 
     27        self.authors.setItemDelegate(author_delegate) 
     28 
     29        self.links.contextMenuEvent = self.linksContextMenuEvent 
     30        link_delegate = jlibAtomLinkItemDelegate(parent=self) 
     31        self.links.setItemDelegate(link_delegate) 
     32 
     33        self.categories.contextMenuEvent = self.categoriesContextMenuEvent 
     34        category_delegate = jlibAtomCategoryItemDelegate(parent=self) 
     35        self.categories.setItemDelegate(category_delegate) 
    2336         
    2437        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), 
     
    2942        self.publication.setDateTime(QtCore.QDateTime.currentDateTime()) 
    3043        self.edition.setDateTime(QtCore.QDateTime.currentDateTime()) 
     44 
     45        #proxy = QtNetwork.QNetworkProxy() 
     46        #proxy.setType(QtNetwork.QNetworkProxy.HttpProxy) 
     47        #proxy.setHostName('') 
     48        #proxy.setPort() 
     49        #QtNetwork.QNetworkProxy.setApplicationProxy(proxy) 
     50        #self.browser.setUrl(QtCore.QUrl('http://maps.google.com')) 
    3151 
    3252    def setNode(self, node): 
     
    122142        self.links.setModel(model) 
    123143        self.links.verticalHeader().hide() 
     144 
     145        categories = entry.get_children('category', ATOM10_NS) 
     146        model = jlibAtomCategoryModel(parent=self.categories) 
     147        model.setCategories(categories) 
     148        self.categories.setModel(model) 
     149        self.categories.verticalHeader().hide() 
    124150 
    125151        # In edition mode we don't want to allow the user 
     
    182208        updated_element = self.entry.get_child('updated', ATOM10_NS) 
    183209        updated_element.xml_text = unicode(QtCore.QDateTime.currentDateTime().toString(QtCore.Qt.ISODate)) 
    184          
     210 
    185211        self.emit(QtCore.SIGNAL("itemReady(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), 
    186212                  self.node, id_element.xml_text, self.entry) 
     
    198224 
    199225    def addNewAuthor(self): 
    200         pass 
     226        author = E(u'author', namespace=ATOM10_NS, prefix=self.entry.xml_prefix, 
     227                   parent=self.entry) 
     228 
     229        self.authors.model().newAuthor(author) 
    201230 
    202231    def delAuthor(self): 
    203         pass 
     232        model = self.authors.model() 
     233        index = self.authors.currentIndex() 
     234        model.removeAuthor(index) 
     235 
     236    def addNewLink(self): 
     237        link = E(u'link', namespace=ATOM10_NS, prefix=self.entry.xml_prefix, 
     238                parent=self.entry) 
     239 
     240        self.links.model().newLink(link) 
     241 
     242    def delLink(self): 
     243        model = self.links.model() 
     244        index = self.links.currentIndex() 
     245        model.removeLink(index) 
     246 
     247    def addNewCategory(self): 
     248        cat = E(u'category', namespace=ATOM10_NS, prefix=self.entry.xml_prefix, 
     249                parent=self.entry) 
     250 
     251        self.categories.model().newCategory(cat) 
     252 
     253    def delCategory(self): 
     254        model = self.categories.model() 
     255        index = self.categories.currentIndex() 
     256        model.removeCategory(index) 
    204257 
    205258    def authorsContextMenuEvent(self, event): 
     
    213266        QtCore.QObject.connect(actionDelAuthor, QtCore.SIGNAL("triggered()"), self.delAuthor) 
    214267        menu.addAction(actionDelAuthor) 
     268 
     269        menu.exec_(event.globalPos()) 
     270 
     271    def linksContextMenuEvent(self, event): 
     272        menu = QtGui.QMenu(self.parent()) 
     273 
     274        actionNewLink = QtGui.QAction(QtCore.QString("Add a new link"), self.parent()) 
     275        QtCore.QObject.connect(actionNewLink, QtCore.SIGNAL("triggered()"), self.addNewLink) 
     276        menu.addAction(actionNewLink) 
     277 
     278        actionDelLink = QtGui.QAction(QtCore.QString("Delete link"), self.parent()) 
     279        QtCore.QObject.connect(actionDelLink, QtCore.SIGNAL("triggered()"), self.delLink) 
     280        menu.addAction(actionDelLink) 
     281 
     282        menu.exec_(event.globalPos()) 
     283 
     284    def categoriesContextMenuEvent(self, event): 
     285        menu = QtGui.QMenu(self.parent()) 
     286 
     287        actionNewCat = QtGui.QAction(QtCore.QString("Add a new category"), self.parent()) 
     288        QtCore.QObject.connect(actionNewCat, QtCore.SIGNAL("triggered()"), self.addNewCategory) 
     289        menu.addAction(actionNewCat) 
     290 
     291        actionDelCat = QtGui.QAction(QtCore.QString("Delete category"), self.parent()) 
     292        QtCore.QObject.connect(actionDelCat, QtCore.SIGNAL("triggered()"), self.delCategory) 
     293        menu.addAction(actionDelCat) 
    215294 
    216295        menu.exec_(event.globalPos()) 
  • oss/jlib/jlib/gui/atom/entryui.py

    r737 r745  
    33# Form implementation generated from reading ui file '..\..\designer\ui\atomentryform.ui' 
    44# 
    5 # Created: Thu Jul 24 15:25:35 2008 
     5# Created: Fri Jul 25 17:21:10 2008 
    66#      by: PyQt4 UI code generator 4.4.2 
    77# 
     
    4949        self.publication.setObjectName("publication") 
    5050        self.gridLayout.addWidget(self.publication,3,1,1,1) 
    51         spacerItem = QtGui.QSpacerItem(268,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) 
     51        spacerItem = QtGui.QSpacerItem(259,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) 
    5252        self.gridLayout.addItem(spacerItem,3,2,2,2) 
    5353        self.label_6 = QtGui.QLabel(self.generalItem) 
     
    7171        self.toolBox.addItem(self.generalItem,"") 
    7272        self.authorItem = QtGui.QWidget() 
    73         self.authorItem.setGeometry(QtCore.QRect(0,0,497,271)) 
     73        self.authorItem.setGeometry(QtCore.QRect(0,0,497,243)) 
    7474        self.authorItem.setObjectName("authorItem") 
    7575        self.verticalLayout = QtGui.QVBoxLayout(self.authorItem) 
     
    8181        self.toolBox.addItem(self.authorItem,"") 
    8282        self.linkItem = QtGui.QWidget() 
    83         self.linkItem.setGeometry(QtCore.QRect(0,0,497,271)) 
     83        self.linkItem.setGeometry(QtCore.QRect(0,0,497,243)) 
    8484        self.linkItem.setObjectName("linkItem") 
    8585        self.verticalLayout_2 = QtGui.QVBoxLayout(self.linkItem) 
     
    107107        self.verticalLayout_5.addWidget(self.content) 
    108108        self.toolBox.addItem(self.contentItem,"") 
     109        self.page = QtGui.QWidget() 
     110        self.page.setObjectName("page") 
     111        self.gridLayout_2 = QtGui.QGridLayout(self.page) 
     112        self.gridLayout_2.setObjectName("gridLayout_2") 
     113        self.browser = QtWebKit.QWebView(self.page) 
     114        self.browser.setUrl(QtCore.QUrl("about:blank")) 
     115        self.browser.setObjectName("browser") 
     116        self.gridLayout_2.addWidget(self.browser,0,0,1,1) 
     117        self.toolBox.addItem(self.page,"") 
    109118        self.verticalLayout_4.addWidget(self.toolBox) 
    110119        self.buttonBox = QtGui.QDialogButtonBox(jlibAtomEntryForm) 
     
    114123 
    115124        self.retranslateUi(jlibAtomEntryForm) 
    116         self.toolBox.setCurrentIndex(0
     125        self.toolBox.setCurrentIndex(5
    117126        QtCore.QMetaObject.connectSlotsByName(jlibAtomEntryForm) 
    118127 
     
    132141        self.toolBox.setItemText(self.toolBox.indexOf(self.categoryItem), QtGui.QApplication.translate("jlibAtomEntryForm", "Categories", None, QtGui.QApplication.UnicodeUTF8)) 
    133142        self.toolBox.setItemText(self.toolBox.indexOf(self.contentItem), QtGui.QApplication.translate("jlibAtomEntryForm", "Content", None, QtGui.QApplication.UnicodeUTF8)) 
     143        self.toolBox.setItemText(self.toolBox.indexOf(self.page), QtGui.QApplication.translate("jlibAtomEntryForm", "Page", None, QtGui.QApplication.UnicodeUTF8)) 
    134144 
     145from PyQt4 import QtWebKit 
  • oss/jlib/jlib/gui/pubsub/node.py

    r740 r745  
    8181            publishMenu.setTitle(QtCore.QString("Publish")) 
    8282             
    83             actionPublishAtomEntry = QtGui.QAction(QtCore.QString("Atom Entry"), self.parent()) 
     83            actionPublishAtomEntry = QtGui.QAction(QtCore.QString("Post"), self.parent()) 
    8484            QtCore.QObject.connect(actionPublishAtomEntry, QtCore.SIGNAL("triggered()"), 
    8585                                   self.publishAtomEntry)