Sat, 28 Sep 2013 20:07:36 +0200
Continued correcting doc strings by using the new doc string checker.
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

1  # * coding: utf8 * 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

2  
2302
f29e9405c851
Updated copyright for 2013.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
1670
diff
changeset

3  # Copyright (c) 2012  2013 Detlev Offenbach <detlev@dieoffenbachs.de> 
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

4  # 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

5  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

6  """ 
2954
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

7  Module implementing a dialog to select the action to be performed on the 
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

8  bookmark. 
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

9  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

10  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

11  from PyQt4.QtCore import pyqtSlot 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

12  from PyQt4.QtGui import QDialog 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

13  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

14  from .Ui_BookmarkActionSelectionDialog import Ui_BookmarkActionSelectionDialog 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

15  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

16  import UI.PixmapCache 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

17  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

18  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

19  class BookmarkActionSelectionDialog(QDialog, Ui_BookmarkActionSelectionDialog): 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

20  """ 
2954
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

21  Class implementing a dialog to select the action to be performed on 
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

22  the bookmark. 
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

23  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

24  Undefined = 1 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

25  AddBookmark = 0 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

26  EditBookmark = 1 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

27  AddSpeeddial = 2 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

28  RemoveSpeeddial = 3 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

29  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

30  def __init__(self, url, parent=None): 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

31  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

32  Constructor 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

33  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

34  @param url URL to be worked on (QUrl) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

35  @param parent reference to the parent widget (QWidget) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

36  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

37  super().__init__(parent) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

38  self.setupUi(self) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

39  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

40  self.__action = self.Undefined 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

41  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

42  self.icon.setPixmap(UI.PixmapCache.getPixmap("bookmark32.png")) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

43  
2403
e3d7a861547c
Continued implementing the delayed import.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2302
diff
changeset

44  import Helpviewer.HelpWindow 
e3d7a861547c
Continued implementing the delayed import.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2302
diff
changeset

45  
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

46  if Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

47  .bookmarkForUrl(url) is None: 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

48  self.__bmAction = self.AddBookmark 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

49  self.bookmarkPushButton.setText(self.trUtf8("Add Bookmark")) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

50  else: 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

51  self.__bmAction = self.EditBookmark 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

52  self.bookmarkPushButton.setText(self.trUtf8("Edit Bookmark")) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

53  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

54  if Helpviewer.HelpWindow.HelpWindow.speedDial().pageForUrl(url).url: 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

55  self.__sdAction = self.RemoveSpeeddial 
2954
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

56  self.speeddialPushButton.setText( 
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

57  self.trUtf8("Remove from Speed Dial")) 
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

58  else: 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

59  self.__sdAction = self.AddSpeeddial 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

60  self.speeddialPushButton.setText(self.trUtf8("Add to Speed Dial")) 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

61  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

62  @pyqtSlot() 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

63  def on_bookmarkPushButton_clicked(self): 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

64  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

65  Private slot handling selection of a bookmark action. 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

66  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

67  self.__action = self.__bmAction 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

68  self.accept() 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

69  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

70  @pyqtSlot() 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

71  def on_speeddialPushButton_clicked(self): 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

72  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

73  Private slot handling selection of a speed dial action. 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

74  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

75  self.__action = self.__sdAction 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

76  self.accept() 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

77  
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

78  def getAction(self): 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

79  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

80  Public method to get the selected action. 
2954
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

81  
bf0215fe12d1
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
2403
diff
changeset

82  @return reference to the associated action 
1670
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

83  """ 
6fd889391d2c
Added a Speed Dial to the web browser including the capability to select the first ten pages by pressing Meta+1 to Meta+0.
Detlev Offenbach <detlev@dieoffenbachs.de>
parents:
diff
changeset

84  return self.__action 