def render_default_deck_chooser(self):
     self.default_deck_chooser_parent_widget = QWidget()
     self.default_deck_chooser = deckchooser.DeckChooser(
         mw, self.default_deck_chooser_parent_widget, label=False)
     self.form.default_deck_checkbox.setChecked(self.filter_deck)
     self.default_deck_chooser_parent_widget.setEnabled(self.filter_deck)
     if self.default_deck:
         self.default_deck_chooser.setDeckName(self.default_deck)
     self.form.default_deck_checkbox.stateChanged.connect(
         self.toggle_default_deck)
     self.form.default_deck_hbox.addWidget(
         self.default_deck_chooser_parent_widget)
Esempio n. 2
0
    def __init__(self):
        super(NotebookEdit, self).__init__()

        self.notebookFile.clicked.connect(self.getFilename)
        self.model = get_nbc_model(mw.col)

        self.deck_container = QWidget()
        self.deckChooser = deckchooser.DeckChooser(mw,
                                                   self.deck_container,
                                                   label=True)
        self.deckChooser.deck.setAutoDefault(False)
        self.did = self.deckChooser.selectedId()

        # showInfo(str(self.model['flds']))
        self.media_path = mw.col.media.dir()
Esempio n. 3
0
    def render_deck_chooser(self):
        self.deck_chooser_parent_widget = QWidget()
        self.deck_chooser = deckchooser.DeckChooser(mw, self.deck_chooser_parent_widget, label=False)
        filter_on_decks = mw.addonManager.getConfig(__name__)[ConfigProperties.FILTER_DECK.value]
        if filter_on_decks:
            default_deck_name = mw.addonManager.getConfig(__name__)[ConfigProperties.DECK.value]
            self.deck_chooser.setDeckName(default_deck_name)
            self.deck_selection_enabled = True
        self.deck_chooser_parent_widget.setEnabled(self.deck_selection_enabled)
        self.form.filter_decks_checkbox.setChecked(self.deck_selection_enabled)

        self.form.filter_decks_checkbox.stateChanged.connect(self.toggle_deck_selection)
        self.deck_chooser.deck.clicked.connect(self.update_deck_name)

        self.update_init_search()

        self.form.filter_decks_hbox.addWidget(self.deck_chooser_parent_widget)
Esempio n. 4
0
    def setup_ui(self):
        layout = QVBoxLayout()
        self.deck_widget = QWidget(mw)
        self.model_widget = QWidget(mw)
        self.text_edit = QTextEdit(mw)
        self.submit_button = QPushButton(mw)
        self.deck_chooser = deckchooser.DeckChooser(mw, self.deck_widget)
        defaults = mw.col.defaults_for_adding(
            current_review_card=mw.reviewer.card)
        self.model_chooser = notetypechooser.NotetypeChooser(
            mw=mw,
            widget=self.model_widget,
            starting_notetype_id=NotetypeId(defaults.notetype_id))

        self.processor_widget = QWidget(mw)
        self.processor_layout = QHBoxLayout(mw)
        self.processor_label = QLabel("Character to split on:")
        self.processor_text = QLineEdit(mw)
        self.processor_text.setMaxLength(1)
        self.processor_text.setFixedWidth(60)
        self.processor_button = QPushButton(mw)
        self.processor_button.setText("Split")
        self.processor_button.clicked.connect(self.split_text)
        self.processor_layout.addWidget(self.processor_label)
        self.processor_layout.addWidget(self.processor_text)
        self.processor_layout.addWidget(self.processor_button)
        self.processor_widget.setLayout(self.processor_layout)

        self.submit_button.setText("Add")
        self.submit_button.clicked.connect(self.add_current_sentences)

        layout.addWidget(self.model_widget)
        layout.addWidget(self.deck_widget)
        layout.addWidget(self.processor_widget)
        layout.addWidget(self.text_edit)
        layout.addWidget(self.submit_button)

        self.setLayout(layout)
        self.setWindowTitle("MassAdd")
        self.setMinimumHeight(300)
        self.setMinimumWidth(400)
Esempio n. 5
0
    def setupUi(self):
        """Set up ImgOccEdit UI"""
        # Main widgets aside from fields
        self.svg_edit = ImgOccWebView(parent=self)
        self.svg_edit._page = ImgOccWebPage(self.svg_edit._onBridgeCmd)
        self.svg_edit.setPage(self.svg_edit._page)

        self.tags_hbox = QHBoxLayout()
        self.tags_edit = tagedit.TagEdit(self)
        self.tags_label = QLabel("Tags")
        self.tags_label.setFixedWidth(70)
        self.deck_container = QWidget()
        self.deckChooser = deckchooser.DeckChooser(mw,
                                                   self.deck_container, label=True)
        self.deckChooser.deck.setAutoDefault(False)

        # workaround for tab focus order issue of the tags entry
        # (this particular section is only needed when the quick deck
        # buttons add-on is installed)
        if self.deck_container.layout().children():  # multiple deck buttons
            for i in range(self.deck_container.layout().children()[0].count()):
                try:
                    item = self.deck_container.layout().children()[0].itemAt(i)
                    # remove Tab focus manually:
                    item.widget().setFocusPolicy(Qt.ClickFocus)
                    item.widget().setAutoDefault(False)
                except AttributeError:
                    pass

        # Button row widgets
        self.bottom_label = QLabel()
        button_box = QDialogButtonBox(Qt.Horizontal, self)
        button_box.setCenterButtons(False)

        image_btn = QPushButton("Change &Image", clicked=self.changeImage)
        image_btn.setIcon(QIcon(os.path.join(ICONS_PATH, "add.png")))
        image_btn.setIconSize(QSize(16, 16))
        image_btn.setAutoDefault(False)
        help_btn = QPushButton("&Help", clicked=self.onHelp)
        help_btn.setAutoDefault(False)

        self.occl_tp_select = QComboBox()
        self.occl_tp_select.addItems(["Don't Change", "Hide All, Guess One",
                                      "Hide One, Guess One"])

        self.edit_btn = button_box.addButton("&Edit Cards",
                                             QDialogButtonBox.ActionRole)
        self.new_btn = button_box.addButton("&Add New Cards",
                                            QDialogButtonBox.ActionRole)
        self.ao_btn = button_box.addButton("Hide &All, Guess One",
                                           QDialogButtonBox.ActionRole)
        self.oa_btn = button_box.addButton("Hide &One, Guess One",
                                           QDialogButtonBox.ActionRole)
        close_button = button_box.addButton("&Close",
                                            QDialogButtonBox.RejectRole)

        image_tt = ("Switch to a different image while preserving all of "
                    "the shapes and fields")
        dc_tt = "Preserve existing occlusion type"
        edit_tt = "Edit all cards using current mask shapes and field entries"
        new_tt = "Create new batch of cards without editing existing ones"
        ao_tt = ("Generate cards with nonoverlapping information, where all<br>"
                 "labels are hidden on the front and one revealed on the back")
        oa_tt = ("Generate cards with overlapping information, where one<br>"
                 "label is hidden on the front and revealed on the back")
        close_tt = "Close Image Occlusion Editor without generating cards"

        image_btn.setToolTip(image_tt)
        self.edit_btn.setToolTip(edit_tt)
        self.new_btn.setToolTip(new_tt)
        self.ao_btn.setToolTip(ao_tt)
        self.oa_btn.setToolTip(oa_tt)
        close_button.setToolTip(close_tt)
        self.occl_tp_select.setItemData(0, dc_tt, Qt.ToolTipRole)
        self.occl_tp_select.setItemData(1, ao_tt, Qt.ToolTipRole)
        self.occl_tp_select.setItemData(2, oa_tt, Qt.ToolTipRole)

        for btn in [image_btn, self.edit_btn, self.new_btn, self.ao_btn,
                    self.oa_btn, close_button]:
            btn.setFocusPolicy(Qt.ClickFocus)

        self.edit_btn.clicked.connect(self.editNote)
        self.new_btn.clicked.connect(self.new)
        self.ao_btn.clicked.connect(self.addAO)
        self.oa_btn.clicked.connect(self.addOA)
        close_button.clicked.connect(self.close)

        # Set basic layout up

        # Button row
        bottom_hbox = QHBoxLayout()
        bottom_hbox.addWidget(image_btn)
        bottom_hbox.addWidget(help_btn)
        bottom_hbox.insertStretch(2, stretch=1)
        bottom_hbox.addWidget(self.bottom_label)
        bottom_hbox.addWidget(self.occl_tp_select)
        bottom_hbox.addWidget(button_box)

        # Tab 1
        vbox1 = QVBoxLayout()

        svg_edit_loader = QLabel("Loading...")
        svg_edit_loader.setAlignment(Qt.AlignCenter)
        loader_icon = os.path.join(ICONS_PATH, "loader.gif")
        anim = QMovie(loader_icon)
        svg_edit_loader.setMovie(anim)
        anim.start()
        self.svg_edit_loader = svg_edit_loader
        self.svg_edit_anim = anim

        vbox1.addWidget(self.svg_edit, stretch=1)
        vbox1.addWidget(self.svg_edit_loader, stretch=1)

        # Tab 2
        # vbox2 fields are variable and added by setupFields() at a later point
        self.vbox2 = QVBoxLayout()

        # Main Tab Widget
        tab1 = QWidget()
        self.tab2 = QWidget()
        tab1.setLayout(vbox1)
        self.tab2.setLayout(self.vbox2)
        self.tab_widget = QTabWidget()
        self.tab_widget.setFocusPolicy(Qt.ClickFocus)
        self.tab_widget.addTab(tab1, "&Masks Editor")
        self.tab_widget.addTab(self.tab2, "&Fields")
        self.tab_widget.setTabToolTip(
            1, "Include additional information (optional)")
        self.tab_widget.setTabToolTip(
            0, "Create image occlusion masks (required)")

        # Main Window
        vbox_main = QVBoxLayout()
        vbox_main.addWidget(self.tab_widget)
        vbox_main.addLayout(bottom_hbox)
        self.setLayout(vbox_main)
        self.setMinimumWidth(640)
        self.tab_widget.setCurrentIndex(0)
        self.svg_edit.setFocus()
        self.showSvgEdit(False)

        # Define and connect key bindings

        # Field focus hotkeys
        for i in range(1, 10):
            QShortcut(QKeySequence("Ctrl+%i" % i),
                      self).activated.connect(lambda f=i-1: self.focusField(f))
        # Other hotkeys
        QShortcut(QKeySequence("Ctrl+Return"),
                  self).activated.connect(lambda: self.defaultAction(True))
        QShortcut(QKeySequence("Ctrl+Shift+Return"),
                  self).activated.connect(lambda: self.addOA(True))
        QShortcut(QKeySequence("Ctrl+Tab"),
                  self).activated.connect(self.switchTabs)
        QShortcut(QKeySequence("Ctrl+r"),
                  self).activated.connect(self.resetMainFields)
        QShortcut(QKeySequence("Ctrl+Shift+r"),
                  self).activated.connect(self.resetAllFields)
        QShortcut(QKeySequence("Ctrl+Shift+t"),
                  self).activated.connect(self.focusTags)
        QShortcut(QKeySequence("Ctrl+f"),
                  self).activated.connect(self.fitImageCanvas)
Esempio n. 6
0
    def setupUi(self):
        """Set up ImgOccEdit UI"""
        # Main widgets aside from fields
        self.svg_edit = webview.AnkiWebView()
        self.svg_edit.setCanFocus(True)  # focus necessary for hotkeys
        self.tags_hbox = QHBoxLayout()
        self.tags_edit = tagedit.TagEdit(self)
        self.tags_label = QLabel("Tags")
        self.tags_label.setFixedWidth(70)
        self.deck_container = QWidget()
        self.deckChooser = deckchooser.DeckChooser(mw,
                                                   self.deck_container,
                                                   label=True)

        # workaround for tab focus order issue of the tags entry
        # (this particular section is only needed when the quick deck
        # buttons add-on is installed)
        if self.deck_container.layout().children():  # multiple deck buttons
            for i in range(self.deck_container.layout().children()[0].count()):
                item = self.deck_container.layout().children()[0].itemAt(i)
                # remove Tab focus manually:
                item.widget().setFocusPolicy(Qt.ClickFocus)

        # Button row widgets
        self.bottom_label = QLabel()
        button_box = QtGui.QDialogButtonBox(QtCore.Qt.Horizontal, self)
        button_box.setCenterButtons(False)

        image_btn = QPushButton("Change &Image", clicked=self.changeImage)
        image_btn.setIcon(QIcon(":/icons/new_occlusion.png"))
        image_btn.setIconSize(QSize(16, 16))

        self.occl_tp_select = QComboBox()
        self.occl_tp_select.addItems([
            "Don't Change", "Hide All, Reveal One", "Hide All, Reveal All",
            "Hide One, Reveal All"
        ])

        self.edit_btn = button_box.addButton("&Edit Cards",
                                             QDialogButtonBox.ActionRole)
        self.new_btn = button_box.addButton("&Add New Cards",
                                            QDialogButtonBox.ActionRole)
        self.ao_btn = button_box.addButton(u"Hide &All, Reveal One",
                                           QDialogButtonBox.ActionRole)
        self.aa_btn = button_box.addButton(u"Hide All, &Reveal All",
                                           QDialogButtonBox.ActionRole)
        self.oa_btn = button_box.addButton(u"Hide &One, Reveal All",
                                           QDialogButtonBox.ActionRole)
        close_button = button_box.addButton("&Close",
                                            QDialogButtonBox.RejectRole)

        image_tt = "Switch to a different image while preserving all of \
            the shapes and fields"

        dc_tt = "Preserve existing occlusion type"
        edit_tt = "Edit all cards using current mask shapes and field entries"
        new_tt = "Create new batch of cards without editing existing ones"
        ao_tt = (
            "Generate cards with nonoverlapping information, where all<br>"
            "labels are hidden on the front and just one is revealed on the back"
        )
        aa_tt = (
            "Generate cards with partial overlapping information, where<br>"
            "all labels are hidden on the front and all are revealed on the back"
        )
        oa_tt = (
            "Generate cards with overlapping information, where just one<br>"
            "label is hidden on the front and all are revealed on the back")
        close_tt = "Close Image Occlusion Editor without generating cards"

        image_btn.setToolTip(image_tt)
        self.edit_btn.setToolTip(edit_tt)
        self.new_btn.setToolTip(new_tt)
        self.ao_btn.setToolTip(ao_tt)
        self.aa_btn.setToolTip(aa_tt)
        self.oa_btn.setToolTip(oa_tt)
        close_button.setToolTip(close_tt)
        self.occl_tp_select.setItemData(0, dc_tt, Qt.ToolTipRole)
        self.occl_tp_select.setItemData(1, ao_tt, Qt.ToolTipRole)
        self.occl_tp_select.setItemData(2, aa_tt, Qt.ToolTipRole)
        self.occl_tp_select.setItemData(3, oa_tt, Qt.ToolTipRole)

        self.connect(self.edit_btn, SIGNAL("clicked()"), self.edit_note)
        self.connect(self.new_btn, SIGNAL("clicked()"), self.new)
        self.connect(self.ao_btn, SIGNAL("clicked()"), self.addAO)
        self.connect(self.aa_btn, SIGNAL("clicked()"), self.addAA)
        self.connect(self.oa_btn, SIGNAL("clicked()"), self.addOA)
        self.connect(close_button, SIGNAL("clicked()"), self.close)

        # Set basic layout up

        ## Button row
        bottom_hbox = QHBoxLayout()
        bottom_hbox.addWidget(image_btn)
        bottom_hbox.insertStretch(1, stretch=1)
        bottom_hbox.addWidget(self.bottom_label)
        bottom_hbox.addWidget(self.occl_tp_select)
        bottom_hbox.addWidget(button_box)

        ## Tab 1
        vbox1 = QVBoxLayout()
        vbox1.addWidget(self.svg_edit, stretch=1)

        ## Tab 2
        self.vbox2 = QVBoxLayout()
        # vbox2 fields are variable and added by setupFields() at a later point

        ## Main Tab Widget
        tab1 = QWidget()
        self.tab2 = QWidget()
        tab1.setLayout(vbox1)
        self.tab2.setLayout(self.vbox2)
        self.tab_widget = QtGui.QTabWidget()
        self.tab_widget.addTab(tab1, "&Masks Editor")
        self.tab_widget.addTab(self.tab2, "&Fields")
        self.tab_widget.setTabToolTip(
            1, "Include additional information (optional)")
        self.tab_widget.setTabToolTip(
            0, "Create image occlusion masks (required)")

        ## Main Window
        vbox_main = QVBoxLayout()
        vbox_main.setMargin(5)
        vbox_main.addWidget(self.tab_widget)
        vbox_main.addLayout(bottom_hbox)
        self.setLayout(vbox_main)
        self.setMinimumWidth(640)
        self.tab_widget.setCurrentIndex(0)
        self.svg_edit.setFocus()

        # Define and connect key bindings

        ## Field focus hotkeys
        for i in range(1, 10):
            s = self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+%i" % i),
                                             self),
                             QtCore.SIGNAL('activated()'),
                             lambda f=i - 1: self.focusField(f))
        ## Other hotkeys
        self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Return"), self),
                     QtCore.SIGNAL('activated()'),
                     lambda: self.defaultAction(True))
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Alt+Return"), self),
            QtCore.SIGNAL('activated()'), lambda: self.addAA(True))
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Shift+Return"), self),
            QtCore.SIGNAL('activated()'), lambda: self.addOA(True))
        self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Tab"), self),
                     QtCore.SIGNAL('activated()'), self.switchTabs)
        self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+r"), self),
                     QtCore.SIGNAL('activated()'), self.resetMainFields)
        self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Shift+r"), self),
                     QtCore.SIGNAL('activated()'), self.resetAllFields)
        self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Shift+t"), self),
                     QtCore.SIGNAL('activated()'),
                     lambda: self.focusField(self.tags_edit))
        self.connect(QtGui.QShortcut(QtGui.QKeySequence("Ctrl+f"), self),
                     QtCore.SIGNAL('activated()'), self.fitImageCanvas)
Esempio n. 7
0
    def initUI(self, tags):
        ##############################################
        ### From top to bottom:
        ##############################################
        ## header_label # self.header_edit
        ##############################################
        ## self.svg_edit
        ##############################################
        ## footer_label # self.footer
        ##############################################
        ## tags_label # self.tags_edit
        ##############################################
        ## deck_container
        ##  ########################
        ##  # deckChooser          #
        ##  ########################
        ##############################################

        # Header
        self.header_edit = QLineEdit()
        self.header_edit.setPlaceholderText("(optional)")
        header_label = QLabel("Header: ")

        header_hbox = QHBoxLayout()
        header_hbox.addWidget(header_label)
        header_hbox.addWidget(self.header_edit)

        # svg-edit
        self.svg_edit = webview.AnkiWebView()
        self.svg_edit.setCanFocus(True)

        # Footer
        self.footer_edit = QLineEdit()
        self.footer_edit.setPlaceholderText("(optional)")
        footer_label = QLabel("Footer: ")

        footer_hbox = QHBoxLayout()
        footer_hbox.addWidget(footer_label)
        footer_hbox.addWidget(self.footer_edit)

        # Tags
        self.tags_edit = tagedit.TagEdit(self)
        self.tags_edit.setText(" ".join(tags))
        self.tags_edit.setCol(mw.col)
        tags_label = QLabel("Tags: ")

        tags_hbox = QHBoxLayout()
        tags_hbox.addWidget(tags_label)
        tags_hbox.addWidget(self.tags_edit)

        deck_container = QGroupBox("Deck")

        self.deckChooser = deckchooser.DeckChooser(mw,
                                                   deck_container,
                                                   label=False)

        vbox = QVBoxLayout()
        vbox.addLayout(header_hbox)
        vbox.addWidget(self.svg_edit, stretch=1)
        vbox.addLayout(footer_hbox)
        vbox.addLayout(tags_hbox)
        vbox.addWidget(deck_container)

        self.setLayout(vbox)
        self.setMinimumHeight(600)
        #  Don't focus on the tags.
        #  When the focus is on the tags an ugly autocomplete
        # list appears, taking away screen real estate for no reason.
        self.header_edit.setFocus()

        self.setWindowTitle('Image Occlusion Editor')
        self.show()
Esempio n. 8
0
    def initUI(self, tags):
        ##############################################
        ### From top to bottom:
        ##############################################
        ## header_label # self.header_edit
        ##############################################
        ## self.svg_edit
        ##############################################
        ## footer_label # self.footer
        ##############################################
        ## tags_label # self.tags_edit
        ##############################################
        ## deck_container
        ##  ########################
        ##  # deckChooser          #
        ##  ########################
        ##############################################

        # Header
        self.header_edit = QLineEdit()
        self.header_edit.setPlaceholderText("(optional)")
        header_label = QLabel("Header: ")

        header_hbox = QHBoxLayout()
        header_hbox.addWidget(header_label)
        header_hbox.addWidget(self.header_edit)

        # svg-edit
        self.svg_edit = webview.AnkiWebView()
        self.svg_edit.setCanFocus(True)

        # Footer
        self.footer_edit = QLineEdit()
        self.footer_edit.setPlaceholderText("(optional)")
        footer_label = QLabel("Footer: ")

        footer_hbox = QHBoxLayout()
        footer_hbox.addWidget(footer_label)
        footer_hbox.addWidget(self.footer_edit)

        # Tags
        self.tags_edit = tagedit.TagEdit(self)
        self.tags_edit.setText(" ".join(tags))
        self.tags_edit.setCol(mw.col)
        tags_label = QLabel("Tags: ")

        tags_hbox = QHBoxLayout()
        tags_hbox.addWidget(tags_label)
        tags_hbox.addWidget(self.tags_edit)

        deck_container = QGroupBox("Deck")

        self.deckChooser = deckchooser.DeckChooser(mw,
                                                   deck_container,
                                                   label=False)

        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addLayout(header_hbox)
        vbox.addWidget(self.svg_edit)
        vbox.addLayout(footer_hbox)
        vbox.addLayout(tags_hbox)
        vbox.addWidget(deck_container)

        self.setLayout(vbox)
        self.setMinimumHeight(600)

        #  Don't focus on the tags.
        #  When the focus is on the tags an ugly autocomplete
        # list appears, taking away screen real estate for no reason.
        self.header_edit.setFocus()

        # define and connect key bindings

        # CTRL+F - fit to canvas
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_F), self),
            QtCore.SIGNAL('activated()'), self.fit_image_canvas)
        # CTRL+1 - focus header field
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_1), self),
            QtCore.SIGNAL('activated()'), self.header_edit.setFocus)
        # CTRL+2 - focus footer field
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_2), self),
            QtCore.SIGNAL('activated()'), self.footer_edit.setFocus)
        # CTRL+I - focus SVG-Edit
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_I), self),
            QtCore.SIGNAL('activated()'), self.svg_edit.setFocus)
        # CTRL+T - focus tags field
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_T), self),
            QtCore.SIGNAL('activated()'), self.tags_edit.setFocus)
        # CTRL+R - reset all fields
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_R), self),
            QtCore.SIGNAL('activated()'), self.reset_all_fields)
        # CTRL + O - add overlapping note
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_O), self),
            QtCore.SIGNAL('activated()'), self.add_overlapping)
        # CTRL + N - add non-overlapping note
        self.connect(
            QtGui.QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_N), self),
            QtCore.SIGNAL('activated()'), self.add_nonoverlapping)
        # Escape - Close Image Occlusion window
        self.connect(QtGui.QShortcut(QtGui.QKeySequence(Qt.Key_Escape), self),
                     QtCore.SIGNAL('activated()'), self.close)

        self.setWindowTitle('Image Occlusion Editor')
        self.show()