summaryrefslogtreecommitdiff
path: root/cad/src/ne1_ui/menus/Ui_FileMenu.py
blob: 0d2700045da6731a96020affc8bb1825ae9b0778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright 2004-2007 Nanorex, Inc.  See LICENSE file for details. 
"""
$Id$
"""

from PyQt4 import QtGui

def setupUi(win):
    """
    Populates the "File" menu which appears in the main window menu bar.

    @param win: NE1's main window object.
    @type  win: Ui_MainWindow
    """
    
    # Populate the "Import" submenu.
    win.importMenu.addAction(win.fileInsertMmpAction)
    win.importMenu.addAction(win.fileInsertPdbAction)
    win.importMenu.addAction(win.fileInsertInAction)
    win.importMenu.addSeparator()
    win.importMenu.addAction(win.fileImportOpenBabelAction)
    win.importMenu.addAction(win.fileImportIOSAction)
    
    #Populate the Fetch submenu
    win.fetchMenu.addAction(win.fileFetchPdbAction)
    
    # Populate the "Export" submenu.
    win.exportMenu.addAction(win.fileExportPdbAction)
    win.exportMenu.addAction(win.fileExportQuteMolXPdbAction)
    win.exportMenu.addSeparator()
    win.exportMenu.addAction(win.fileExportJpgAction)
    win.exportMenu.addAction(win.fileExportPngAction)
    win.exportMenu.addAction(win.fileExportPovAction)
    win.exportMenu.addAction(win.fileExportAmdlAction)
    win.exportMenu.addSeparator()
    win.exportMenu.addAction(win.fileExportOpenBabelAction)
    win.exportMenu.addAction(win.fileExportIOSAction)
    
    # Populate the "File" menu.
    win.fileMenu.addAction(win.fileOpenAction)
    win.fileMenu.addAction(win.fileCloseAction)
    win.fileMenu.addSeparator()
    win.fileMenu.addAction(win.fileSaveAction)
    win.fileMenu.addAction(win.fileSaveAsAction)
    win.fileMenu.addSeparator()
    win.fileMenu.addMenu(win.importMenu)
    win.fileMenu.addMenu(win.exportMenu)
    
    from utilities.GlobalPreferences import ENABLE_PROTEINS
    if ENABLE_PROTEINS:
        win.fileMenu.addMenu(win.fetchMenu)
        
    win.fileMenu.addSeparator()
    win.fileMenu.addAction(win.fileExitAction)
    
    # Create and add the "Open Recent Files" submenu.
    win.createOpenRecentFilesMenu()

def retranslateUi(win):
    """
    Sets text related attributes for the "File" menu.

    @param win: NE1's mainwindow object.
    @type  win: U{B{QMainWindow}<http://doc.trolltech.com/4/qmainwindow.html>}
    """
    win.fileMenu.setTitle(
        QtGui.QApplication.translate(
            "MainWindow", "&File", 
            None, QtGui.QApplication.UnicodeUTF8))
    win.importMenu.setTitle(
        QtGui.QApplication.translate(
            "MainWindow", "Import", 
            None, QtGui.QApplication.UnicodeUTF8))
    win.exportMenu.setTitle(
        QtGui.QApplication.translate(
            "MainWindow", "Export", 
            None, QtGui.QApplication.UnicodeUTF8))
    win.fetchMenu.setTitle(
        QtGui.QApplication.translate(
            "MainWindow", "Fetch", 
            None, QtGui.QApplication.UnicodeUTF8))
    win.openRecentFilesMenu.setTitle(
        QtGui.QApplication.translate(
            "MainWindow", "Open Recent Files", 
            None, QtGui.QApplication.UnicodeUTF8))