Ejemplo n.º 1
0
    def __init__(self, address_objects, chosen=0, parent=None):
        '''
        :param: :doc:`AddressObjects`
        :kword: chosen - the chosen index
        :kword: parent widget QtGui.QWidget or None
        '''
        super(AddressDialog, self).__init__(parent)
        self.setWindowTitle(_("Edit Addresses"))

        #a pointer to the records stored in the :doc:`AddressObjects`
        self.addresses = address_objects.records

        self.value_store_dict = {}

        self.advanced_widg = AdvancedAddressOptionsWidget(self)
        self.add_advanced_widget(self.advanced_widg)

        self.stacked_widget = QtGui.QStackedWidget()
        self.insertWidget(self.stacked_widget)

        self.existing_address_widget = QtGui.QWidget()  #see next conditional

        new_addy_widget = NewAddressWidget(address_objects, self)
        self.stacked_widget.addWidget(new_addy_widget)

        if len(self.addresses) == 0:
            self.button_box.hide()
            page = 0

        else:
            self.existing_address_widget = \
                ExistingAddressWidget(address_objects, chosen, self)
            page = 1
        self.stacked_widget.addWidget(self.existing_address_widget)
        self.stacked_widget.setCurrentIndex(page)

        self.connect(new_addy_widget, QtCore.SIGNAL("new address entered"),
                     self.new_address_entered)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show history"),
                     self.show_history)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show advanced ui"),
                     self.advanced_ui)

        self.connect(self.advanced_widg, QtCore.SIGNAL("new address mode"),
                     self.show_new_addy_widget)

        self.enableApply()
Ejemplo n.º 2
0
    def __init__(self, address_objects, chosen=0, parent=None):
        """
        :param: :doc:`AddressObjects`
        :kword: chosen - the chosen index
        :kword: parent widget QtGui.QWidget or None
        """
        super(AddressDialog, self).__init__(parent)
        self.setWindowTitle(_("Edit Addresses"))

        # a pointer to the records stored in the :doc:`AddressObjects`
        self.addresses = address_objects.records

        self.value_store_dict = {}

        self.advanced_widg = AdvancedAddressOptionsWidget(self)
        self.add_advanced_widget(self.advanced_widg)

        self.stacked_widget = QtGui.QStackedWidget()
        self.insertWidget(self.stacked_widget)

        self.existing_address_widget = QtGui.QWidget()  # see next conditional

        new_addy_widget = NewAddressWidget(address_objects, self)
        self.stacked_widget.addWidget(new_addy_widget)

        if len(self.addresses) == 0:
            self.button_box.hide()
            page = 0

        else:
            self.existing_address_widget = ExistingAddressWidget(address_objects, chosen, self)
            page = 1
        self.stacked_widget.addWidget(self.existing_address_widget)
        self.stacked_widget.setCurrentIndex(page)

        self.connect(new_addy_widget, QtCore.SIGNAL("new address entered"), self.new_address_entered)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show history"), self.show_history)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show advanced ui"), self.advanced_ui)

        self.connect(self.advanced_widg, QtCore.SIGNAL("new address mode"), self.show_new_addy_widget)

        self.enableApply()
Ejemplo n.º 3
0
class AddressDialog(ExtendableDialog):
    def __init__(self, address_objects, chosen=0, parent=None):
        '''
        :param: :doc:`AddressObjects`
        :kword: chosen - the chosen index
        :kword: parent widget QtGui.QWidget or None
        '''
        super(AddressDialog, self).__init__(parent)
        self.setWindowTitle(_("Edit Addresses"))

        #a pointer to the records stored in the :doc:`AddressObjects`
        self.addresses = address_objects.records

        self.value_store_dict = {}

        self.advanced_widg = AdvancedAddressOptionsWidget(self)
        self.add_advanced_widget(self.advanced_widg)

        self.stacked_widget = QtGui.QStackedWidget()
        self.insertWidget(self.stacked_widget)

        self.existing_address_widget = QtGui.QWidget()  #see next conditional

        new_addy_widget = NewAddressWidget(address_objects, self)
        self.stacked_widget.addWidget(new_addy_widget)

        if len(self.addresses) == 0:
            self.button_box.hide()
            page = 0

        else:
            self.existing_address_widget = \
                ExistingAddressWidget(address_objects, chosen, self)
            page = 1
        self.stacked_widget.addWidget(self.existing_address_widget)
        self.stacked_widget.setCurrentIndex(page)

        self.connect(new_addy_widget, QtCore.SIGNAL("new address entered"),
                     self.new_address_entered)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show history"),
                     self.show_history)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show advanced ui"),
                     self.advanced_ui)

        self.connect(self.advanced_widg, QtCore.SIGNAL("new address mode"),
                     self.show_new_addy_widget)

        self.enableApply()

    def exec_(self):
        while True:
            if ExtendableDialog.exec_(self):
                try:
                    self.existing_address_widget.apply()
                except AttributeError:
                    pass
                break
            else:
                return False
        return True

    def Advise(self, *args):
        if __name__ == "__main__":
            print args
        self.emit(QtCore.SIGNAL("Advise"), *args)

    def advanced_ui(self, i):
        self.existing_address_widget.toggle_advanced_ui(i)
        self.more_but.click()
        self.setFixedWidth(self.existing_address_widget.width())

    def show_new_addy_widget(self, i):
        self.stacked_widget.setCurrentIndex(i)

    def new_address_entered(self):
        self.accept()

    def show_history(self):
        self.more_but.click()

        dl = AddressHistoryDialog(self.addresses, self)
        dl.exec_()
Ejemplo n.º 4
0
class AddressDialog(ExtendableDialog):
    def __init__(self, address_objects, chosen=0, parent=None):
        """
        :param: :doc:`AddressObjects`
        :kword: chosen - the chosen index
        :kword: parent widget QtGui.QWidget or None
        """
        super(AddressDialog, self).__init__(parent)
        self.setWindowTitle(_("Edit Addresses"))

        # a pointer to the records stored in the :doc:`AddressObjects`
        self.addresses = address_objects.records

        self.value_store_dict = {}

        self.advanced_widg = AdvancedAddressOptionsWidget(self)
        self.add_advanced_widget(self.advanced_widg)

        self.stacked_widget = QtGui.QStackedWidget()
        self.insertWidget(self.stacked_widget)

        self.existing_address_widget = QtGui.QWidget()  # see next conditional

        new_addy_widget = NewAddressWidget(address_objects, self)
        self.stacked_widget.addWidget(new_addy_widget)

        if len(self.addresses) == 0:
            self.button_box.hide()
            page = 0

        else:
            self.existing_address_widget = ExistingAddressWidget(address_objects, chosen, self)
            page = 1
        self.stacked_widget.addWidget(self.existing_address_widget)
        self.stacked_widget.setCurrentIndex(page)

        self.connect(new_addy_widget, QtCore.SIGNAL("new address entered"), self.new_address_entered)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show history"), self.show_history)

        self.connect(self.advanced_widg, QtCore.SIGNAL("show advanced ui"), self.advanced_ui)

        self.connect(self.advanced_widg, QtCore.SIGNAL("new address mode"), self.show_new_addy_widget)

        self.enableApply()

    def exec_(self):
        while True:
            if ExtendableDialog.exec_(self):
                try:
                    self.existing_address_widget.apply()
                except AttributeError:
                    pass
                break
            else:
                return False
        return True

    def Advise(self, *args):
        if __name__ == "__main__":
            print args
        self.emit(QtCore.SIGNAL("Advise"), *args)

    def advanced_ui(self, i):
        self.existing_address_widget.toggle_advanced_ui(i)
        self.more_but.click()
        self.setFixedWidth(self.existing_address_widget.width())

    def show_new_addy_widget(self, i):
        self.stacked_widget.setCurrentIndex(i)

    def new_address_entered(self):
        self.accept()

    def show_history(self):
        self.more_but.click()

        dl = AddressHistoryDialog(self.addresses, self)
        dl.exec_()