Sun, 25 Mar 2012 17:53:22 +0200
Added a dialog to edit bookmark properties and the description to the add bookmark dialog (forgot to add the new files).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Documentation/Source/eric5.Helpviewer.Bookmarks.BookmarkPropertiesDialog.html Sun Mar 25 17:53:22 2012 +0200 @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' +'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> +<html><head> +<title>eric5.Helpviewer.Bookmarks.BookmarkPropertiesDialog</title> +<style> +body { + background: #EDECE6; + margin: 0em 1em 10em 1em; + color: black; +} + +h1 { color: white; background: #85774A; } +h2 { color: white; background: #85774A; } +h3 { color: white; background: #9D936E; } +h4 { color: white; background: #9D936E; } + +a { color: #BA6D36; } + +</style> +</head> +<body><a NAME="top" ID="top"></a> +<h1>eric5.Helpviewer.Bookmarks.BookmarkPropertiesDialog</h1> +<p> +Module implementing a dialog to show and edit bookmark properties. +</p> +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Classes</h3> +<table> +<tr> +<td><a href="#BookmarkPropertiesDialog">BookmarkPropertiesDialog</a></td> +<td>Class implementing a dialog to show and edit bookmark properties.</td> +</tr> +</table> +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> +<hr /><hr /> +<a NAME="BookmarkPropertiesDialog" ID="BookmarkPropertiesDialog"></a> +<h2>BookmarkPropertiesDialog</h2> +<p> + Class implementing a dialog to show and edit bookmark properties. +</p> +<h3>Derived from</h3> +QDialog, Ui_BookmarkPropertiesDialog +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#BookmarkPropertiesDialog.__init__">BookmarkPropertiesDialog</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#BookmarkPropertiesDialog.accept">accept</a></td> +<td>Public slot handling the acceptance of the dialog.</td> +</tr> +</table> +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<a NAME="BookmarkPropertiesDialog.__init__" ID="BookmarkPropertiesDialog.__init__"></a> +<h4>BookmarkPropertiesDialog (Constructor)</h4> +<b>BookmarkPropertiesDialog</b>(<i>node, parent=None</i>) +<p> + Constructor +</p><dl> +<dt><i>parent</i></dt> +<dd> +reference to the parent widget (QWidget) +</dd> +</dl><a NAME="BookmarkPropertiesDialog.accept" ID="BookmarkPropertiesDialog.accept"></a> +<h4>BookmarkPropertiesDialog.accept</h4> +<b>accept</b>(<i></i>) +<p> + Public slot handling the acceptance of the dialog. +</p> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Helpviewer/Bookmarks/BookmarkPropertiesDialog.py Sun Mar 25 17:53:22 2012 +0200 @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module implementing a dialog to show and edit bookmark properties. +""" + +from PyQt4.QtGui import QDialog + +from .Ui_BookmarkPropertiesDialog import Ui_BookmarkPropertiesDialog + +from .BookmarkNode import BookmarkNode + +import Helpviewer.HelpWindow + + +class BookmarkPropertiesDialog(QDialog, Ui_BookmarkPropertiesDialog): + """ + Class implementing a dialog to show and edit bookmark properties. + """ + def __init__(self, node, parent=None): + """ + Constructor + + @param parent reference to the parent widget (QWidget) + """ + super().__init__(parent) + self.setupUi(self) + + self.__node = node + if self.__node.type() == BookmarkNode.Folder: + self.addressLabel.hide() + self.addressEdit.hide() + + self.nameEdit.setText(self.__node.title) + self.descriptionEdit.setPlainText(self.__node.desc) + self.addressEdit.setText(self.__node.url) + + def accept(self): + """ + Public slot handling the acceptance of the dialog. + """ + if (self.__node.type() == BookmarkNode.Bookmark and \ + not self.addressEdit.text()) or \ + not self.nameEdit.text(): + super().accept() + return + + bookmarksManager = Helpviewer.HelpWindow.HelpWindow.bookmarksManager() + title = self.nameEdit.text() + if title != self.__node.title: + bookmarksManager.setTitle(self.__node, title) + if self.__node.type() == BookmarkNode.Bookmark: + url = self.addressEdit.text() + if url != self.__node.url: + bookmarksManager.setUrl(self.__node, url) + description = self.descriptionEdit.toPlainText() + if description != self.__node.desc: + self.__node.desc = description + bookmarksManager.setNodeChanged(self.__node) + + super().accept()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Helpviewer/Bookmarks/BookmarkPropertiesDialog.ui Sun Mar 25 17:53:22 2012 +0200 @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>BookmarkPropertiesDialog</class> + <widget class="QDialog" name="BookmarkPropertiesDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>221</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>500</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>500</width> + <height>250</height> + </size> + </property> + <property name="windowTitle"> + <string>Bookmark Properties</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Name:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="E5LineEdit" name="nameEdit"> + <property name="toolTip"> + <string>Enter the name</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="addressLabel"> + <property name="text"> + <string>Address:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="E5LineEdit" name="addressEdit"> + <property name="toolTip"> + <string>Enter the address</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Description:</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPlainTextEdit" name="descriptionEdit"> + <property name="toolTip"> + <string>Enter a description</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>E5LineEdit</class> + <extends>QLineEdit</extends> + <header>E5Gui/E5LineEdit.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>nameEdit</tabstop> + <tabstop>addressEdit</tabstop> + <tabstop>descriptionEdit</tabstop> + <tabstop>buttonBox</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>BookmarkPropertiesDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>BookmarkPropertiesDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui>