def __init__(self, parent, id):
        # define the top window

        super(edit_shipment, self).__init__(parent=parent)
        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.DUG_connection_obj = self.parent.DUG_connection_obj

        grid = QtGui.QGridLayout()

        self.new_shipment = self.db_connection_obj.sess.query(
            self.db_connection_obj.Shipments).filter(
                self.db_connection_obj.Shipments.id == id).first()

        self.result = self.new_shipment.__dict__

        keys_list = [
            'Id', 'Shipment Number', 'Air way bill number', "Number of boxes"
        ]
        keys_dict = {}
        keys_dict['Id'] = create_center_data('Automatic')
        keys_dict['Shipment Number'] = QtGui.QLineEdit()
        keys_dict['Air way bill number'] = QtGui.QLineEdit()
        keys_dict["Number of boxes"] = QtGui.QLineEdit()

        self.shipment_def = keys_dict

        for i in range(0, len(keys_list)):
            grid.addWidget(create_center_data(keys_list[i]), i + 1, 0)
            grid.addWidget(keys_dict[keys_list[i]], i + 1, 1, 1, 2)

        for i in range(len(keys_list), 22):
            grid.addWidget(create_center_blank(""), i + 1, 1)

        j = len(keys_list)

        self.pb_save = QtGui.QPushButton()
        self.pb_save.setText('Update')
        self.pb_save.setStatusTip('Save Shipment to the database')
        self.pb_save.clicked.connect(self.update_shipment)

        grid.addWidget(self.pb_save, j + 1, 0)

        self.pb_exit = QtGui.QPushButton()
        self.pb_exit.setText('Back')
        self.pb_exit.setStatusTip('Back to main deliverables Menu')
        self.pb_exit.clicked.connect(self.parent.set_shipments_summary)

        grid.addWidget(self.pb_exit, j + 2, 0)

        self.object_to_gui()

        self.setLayout(grid)

        self.show()
コード例 #2
0
    def __init__(self, parent, id):
        # define the top window

        super(edit_usb_window, self).__init__(parent=parent)
        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.DUG_connection_obj = self.parent.DUG_connection_obj

        grid = QtGui.QGridLayout()

        self.new_usb = self.db_connection_obj.sess.query(
            self.db_connection_obj.USB_list).filter(
                self.db_connection_obj.USB_list.usb_id == id).first()

        self.result = self.new_usb.__dict__

        keys_list = ['Id', 'Label', 'Capacity in TB', "Serial no"]

        keys_dict = {}
        keys_dict['Id'] = create_center_data('Automatic')
        keys_dict['Label'] = QtGui.QLineEdit()
        keys_dict['Capacity in TB'] = QtGui.QLineEdit()
        keys_dict['Serial no'] = QtGui.QLineEdit()

        self.usb_def = keys_dict

        for i in range(0, len(keys_list)):
            grid.addWidget(create_center_data(keys_list[i]), i + 1, 0)
            grid.addWidget(keys_dict[keys_list[i]], i + 1, 1, 1, 2)

        for i in range(len(keys_list), 15):
            grid.addWidget(create_center_blank(""), i + 1, 1)

        j = len(keys_list)

        self.pb_save = QtGui.QPushButton()
        self.pb_save.setText('Update')
        self.pb_save.setStatusTip('Save USB to the database')
        self.pb_save.clicked.connect(self.update_usb)

        grid.addWidget(self.pb_save, j + 1, 0)

        self.pb_exit = QtGui.QPushButton()
        self.pb_exit.setText('Back')
        self.pb_exit.setStatusTip('Back to main USB Menu')
        self.pb_exit.clicked.connect(self.parent.set_usb_summary)

        grid.addWidget(self.pb_exit, j + 2, 0)

        self.object_to_gui()

        self.setLayout(grid)

        self.show()
    def __init__(self, parent):
        # define the top window

        super(add_new_shipment, self).__init__(parent=parent)

        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.DUG_connection_obj = self.parent.DUG_connection_obj

        grid = QtGui.QGridLayout()

        grid.addWidget(create_central_labels("Create New shipment"), 0, 0, 1,
                       3)

        keys_list = [
            'Id', 'Shipment Number', 'Air way bill number', "Number of boxes"
        ]

        keys_dict = {}
        keys_dict['Id'] = create_center_data('Automatic')
        keys_dict['Shipment Number'] = QtGui.QLineEdit()
        keys_dict['Air way bill number'] = QtGui.QLineEdit()
        keys_dict["Number of boxes"] = QtGui.QLineEdit()

        self.shipment_def = keys_dict

        for i in range(0, len(keys_list)):
            grid.addWidget(create_center_data(keys_list[i]), i + 1, 0)
            grid.addWidget(keys_dict[keys_list[i]], i + 1, 1, 1, 2)

        for i in range(len(keys_list), 15):
            grid.addWidget(create_center_blank(""), i + 1, 1)

        self.pb_save = QtGui.QPushButton()
        self.pb_save.setText('Save')
        self.pb_save.setStatusTip('Save Shipment to the database')
        self.pb_save.clicked.connect(self.save_shipment)

        grid.addWidget(self.pb_save, 17, 0)

        self.pb_exit = QtGui.QPushButton()
        self.pb_exit.setText('Back')
        self.pb_exit.setStatusTip('Back to main Shipment Menu')
        self.pb_exit.clicked.connect(self.parent.set_shipment_tools)

        grid.addWidget(self.pb_exit, 17, 1)

        self.setLayout(grid)
コード例 #4
0
    def __init__(self, parent):
        # define the top window

        super(add_usb_label, self).__init__()

        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.DUG_connection_obj = self.parent.DUG_connection_obj

        grid = QtGui.QGridLayout()

        grid.addWidget(create_central_labels("Create New USB label"), 0, 0, 1,
                       3)

        keys_list = ['Id', 'Label', 'Capacity in TB', "Serial no"]

        keys_dict = {}
        keys_dict['Id'] = create_center_data('Automatic')
        keys_dict['Label'] = QtGui.QLineEdit()
        keys_dict['Capacity in TB'] = QtGui.QLineEdit()
        keys_dict['Serial no'] = QtGui.QLineEdit()

        self.usb_def = keys_dict

        for i in range(0, len(keys_list)):
            grid.addWidget(create_center_data(keys_list[i]), i + 1, 0)
            grid.addWidget(keys_dict[keys_list[i]], i + 1, 1, 1, 2)

        for i in range(len(keys_list), 15):
            grid.addWidget(create_center_blank(""), i + 1, 1)

        self.pb_save = QtGui.QPushButton()
        self.pb_save.setText('Save')
        self.pb_save.setStatusTip('Save USB label to database')
        self.pb_save.clicked.connect(self.save_usb_label)

        grid.addWidget(self.pb_save, 17, 0)

        self.pb_exit = QtGui.QPushButton()
        self.pb_exit.setText('Back')
        self.pb_exit.setStatusTip('Back to main Shipment Menu')
        self.pb_exit.clicked.connect(self.parent.set_usb_functions)

        grid.addWidget(self.pb_exit, 17, 1)

        self.setLayout(grid)
コード例 #5
0
    def __init__(self, parent):
        # define the top window

        super(Deliverables_summary_window, self).__init__(parent=parent)
        self.parent = parent
        self.tool_tip_dict = tool_tips_mapper_dict['deliverables']
        self.setToolTip(self.tool_tip_dict['general'])
        self.db_connection_obj = self.parent.db_connection_obj  # use this line to pass the connection object between the parent and the child
        grid = QtGui.QGridLayout()
        #header
        title = create_central_labels('Deliverables sumary')
        title.setMaximumHeight(50)
        grid.addWidget(title, 0, 0, 1, 6)

        #---------------------------------------------
        #  **creating the label for the widget table
        #---------------------------------------------
        labels_text = ["Id", "Name", "Class", "Type", "Media", "Copies"]
        labels_list = []
        for label in labels_text:
            labels_list.append(create_central_labels(label))
        for i in range(0, len(labels_list)):
            grid.addWidget(labels_list[i], 1, i)
        #----------------------------------------------------------------------------------
        #  **** Now searcing for existing deliverables in the database and displaying them
        #----------------------------------------------------------------------------------
        self.existing_deliverables_list_dict = fetch_deliverables_list(
            self.db_connection_obj)
        sobj = self.existing_deliverables_list_dict
        for j in range(0, len(sobj)):
            grid.addWidget(create_center_data(str(sobj[j]['id'])), j + 2, 0)
            grid.addWidget(create_center_data(str(sobj[j]['name'])), j + 2, 1)
            grid.addWidget(create_center_data(str(sobj[j]['class_d'])), j + 2,
                           2)
            grid.addWidget(create_center_data(str(sobj[j]['type'])), j + 2, 3)
            grid.addWidget(create_center_data(str(sobj[j]['media'])), j + 2, 4)
            grid.addWidget(create_center_data(str(sobj[j]['copies'])), j + 2,
                           5)

        #Make it look organized------------------------------------------------
        for j in range(len(sobj), 22):
            for i in range(0, 6):
                grid.addWidget(create_center_blank(""), j + 1, i)
        #----------------------------------------------------------
        # Adding the button to add deliverable, edit existing one or delete
        #----------------------------------------------------------
        j = 22
        self.pb_add = QtGui.QPushButton()
        self.pb_add.setText("+")
        self.pb_add.clicked.connect(self.parent.set_new_deliverable)
        grid.addWidget(self.pb_add, j, 0)
        self.pb_add.setToolTip(self.tool_tip_dict['add'])

        self.pb_edit = QtGui.QPushButton()
        self.pb_edit.setText('Edit')
        self.pb_edit.clicked.connect(self.edit_single_deliverable)
        grid.addWidget(self.pb_edit, j, 2)
        self.pb_edit.setToolTip(self.tool_tip_dict['edit'])

        self.pb_view = QtGui.QPushButton()
        self.pb_view.setText('View')
        self.pb_view.clicked.connect(self.view_single_deliverable_detail)
        grid.addWidget(self.pb_view, j, 1)
        self.pb_view.setToolTip(self.tool_tip_dict['view'])

        self.pb_delete = QtGui.QPushButton()
        self.pb_delete.setText('Delete')
        self.pb_delete.clicked.connect(self.delete_deliverable)
        grid.addWidget(self.pb_delete, j, 3)
        self.pb_delete.setToolTip(self.tool_tip_dict['delete'])

        self.pb_home = QtGui.QPushButton()
        self.pb_home.setText('Exit')
        self.pb_home.clicked.connect(self.parent.show_project_info)
        grid.addWidget(self.pb_home, j, 5)
        self.pb_home.setToolTip(self.tool_tip_dict['exit'])

        self.setLayout(grid)
class pop_up_check_combo_box_media_association(QtGui.QWidget):
    closed = QtCore.pyqtSignal()

    def __init__(self, parent, title, combo_list, (a, b), (c, d)):
        super(pop_up_check_combo_box_media_association, self).__init__()

        self.deliverable = c
        self.set_no = d
        self.shipment_no = a
        self.box_no = b
        self.media_list = combo_list

        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.setWindowTitle(title)

        self.widget = QtGui.QWidget()
        grid = QtGui.QGridLayout()

        self.media_dict = {}

        i = 0

        for media in combo_list:
            key = str(media.media_label + " : " + media.reel_no)
            btn = QtGui.QCheckBox(
                str(media.media_label + " : " + media.reel_no))
            btn.setObjectName(str(media.media_label + " : " + media.reel_no))
            if media.shipment_no == a and media.box_no == b:
                btn.setChecked(True)
                data = True
            else:
                btn.setChecked(False)
                data = False
            self.media_dict.update({key: data})
            btn.stateChanged.connect(self.btnstate)

            grid.addWidget(btn, i, 0)

            i = i + 1

        pb_ok = QtGui.QPushButton("OK")
        pb_ok.clicked.connect(self.ok_return)

        self.setMinimumWidth(300)
        self.widget.setLayout(grid)
        scroll = QtGui.QScrollArea()
        scroll.setWidget(self.widget)
        scroll.setWidgetResizable(True)
        scroll.setFixedHeight(600)

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(create_central_labels(a), 0)
        layout.addWidget(create_central_labels(str("Box no : " + str(d))), 1)
        layout.addWidget(create_central_labels(str(c.id) + "_" + c.name), 2)
        layout.addWidget(create_central_labels(str("Set no: " + str(d))), 3)
        layout.addWidget(
            create_center_blank(
                " Available Media list (Media Label : Reel_no) "), 4)
        layout.addWidget(scroll, 5)
        layout.addWidget(pb_ok, 6)

        self.show()
    def __init__(self, parent):
        # define the top window

        super(usb_summary_window, self).__init__()
        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.DUG_connection_obj = self.parent.DUG_connection_obj

        grid =  QtGui.QGridLayout()

        grid.addWidget(create_central_labels("USB Summary"),0,0,1,4)

        labels_text = ["Id", "USB # ",  "Capacity" , "Serial #"]
        labels_list = []
        for label in labels_text:
            labels_list.append(create_central_labels(label))
        for i in range(0, len(labels_list)):
            grid.addWidget(labels_list[i], 1, i)

        # ----------------------------------------------------------------------------------
        #  **** Now searcing for existing shipments in the database and displaying them
        # ----------------------------------------------------------------------------------
        self.existing_usb_list_dict = fetch_usb_list_dict(self.db_connection_obj)

        sobj = self.existing_usb_list_dict

        for j in range(0, len(sobj)):
            grid.addWidget(create_center_data(str(sobj[j]['usb_id'])), j + 2, 0)
            grid.addWidget(create_center_data(str(sobj[j]['label'])), j + 2, 1)
            grid.addWidget(create_center_data(str(sobj[j]['capacity_tb'])), j + 2, 2)
            grid.addWidget(create_center_data(str(sobj[j]['serial_no'])), j + 2, 3)


        # Make it look organized------------------------------------------------
        for j in range(len(sobj), 22):
            for i in range(0, 4):
                grid.addWidget(create_center_blank(""), j + 1, i)
        # ----------------------------------------------------------
        # Adding the button to add deliverable, edit existing one or delete
        # ----------------------------------------------------------
        j = 22

        self.pb_add = QtGui.QPushButton()
        self.pb_add.setText("+")
        self.pb_add.setStatusTip('Add more USB')
        self.pb_add.clicked.connect(self.parent.set_add_usb_label)
        grid.addWidget(self.pb_add, j, 0)

        self.pb_edit = QtGui.QPushButton()
        self.pb_edit.setText('Edit')
        self.pb_edit.setStatusTip('Edit and existing USB')
        self.pb_edit.clicked.connect(self.edit_single_usb)
        grid.addWidget(self.pb_edit, j, 1)

        self.pb_delete = QtGui.QPushButton()
        self.pb_delete.setText('Delete')
        self.pb_delete.setStatusTip('Delete an existing USB')
        self.pb_delete.clicked.connect(self.delete_usb)
        grid.addWidget(self.pb_delete, j, 2)

        self.pb_home = QtGui.QPushButton()
        self.pb_home.setText('Exit')
        self.pb_home.setStatusTip('Exit and return to Home screen ')
        self.pb_home.clicked.connect(self.parent.show_project_info)
        grid.addWidget(self.pb_home, j, 3)

        self.setLayout(grid)
    def __init__(self, parent):
        # define the top window

        super(shipment_summary, self).__init__()
        self.parent = parent
        self.db_connection_obj = self.parent.db_connection_obj
        self.DUG_connection_obj = self.parent.DUG_connection_obj

        grid = QtGui.QGridLayout()

        grid.addWidget(create_central_labels("Shipments Summary"), 0, 0, 1, 4)

        labels_text = ["Id", "shipment # ", "AWB #"]
        labels_list = []
        for label in labels_text:
            labels_list.append(create_central_labels(label))
        for i in range(0, len(labels_list) - 1):
            grid.addWidget(labels_list[i], 1, i)

        grid.addWidget(labels_list[2], 1, 2, 1, 2)
        # ----------------------------------------------------------------------------------
        #  **** Now searcing for existing shipments in the database and displaying them
        # ----------------------------------------------------------------------------------
        self.existing_shipment_list_dict = fetch_shipments_list(
            self.db_connection_obj)

        sobj = self.existing_shipment_list_dict

        for j in range(0, len(sobj)):
            grid.addWidget(create_center_data(str(sobj[j]['id'])), j + 2, 0)
            grid.addWidget(create_center_data(str(sobj[j]['number'])), j + 2,
                           1)
            grid.addWidget(create_center_data(str(sobj[j]['awb_no'])), j + 2,
                           2, 1, 2)

        # Make it look organized------------------------------------------------
        for j in range(len(sobj), 22):
            for i in range(0, 3):
                grid.addWidget(create_center_blank(""), j + 1, i)
        # ----------------------------------------------------------
        # Adding the button to add deliverable, edit existing one or delete
        # ----------------------------------------------------------
        j = 21

        self.pb_add = QtGui.QPushButton()
        self.pb_add.setText("+")
        self.pb_add.setStatusTip('Add more shipments')
        self.pb_add.clicked.connect(self.parent.set_add_shipment)
        grid.addWidget(self.pb_add, j, 0)

        self.pb_edit = QtGui.QPushButton()
        self.pb_edit.setText('Edit')
        self.pb_edit.setStatusTip('Edit and existing deliverable')
        self.pb_edit.clicked.connect(self.edit_single_shipment)
        grid.addWidget(self.pb_edit, j, 1)

        self.pb_delete = QtGui.QPushButton()
        self.pb_delete.setText('Delete')
        self.pb_delete.setStatusTip('Delete an existing deliverable')
        self.pb_delete.clicked.connect(self.delete_shipment)
        grid.addWidget(self.pb_delete, j, 2)

        self.pb_home = QtGui.QPushButton()
        self.pb_home.setText('Exit')
        self.pb_home.setStatusTip('Exit and return to Home screen ')
        self.pb_home.clicked.connect(self.parent.show_project_info)
        grid.addWidget(self.pb_home, j, 3)

        self.pb_report = QtGui.QPushButton()
        self.pb_report.setText('Content report')
        self.pb_report.setStatusTip('Show shipment content report')
        self.pb_report.clicked.connect(self.shipment_content_report)
        grid.addWidget(self.pb_report, j + 1, 0, 1, 4)

        self.setLayout(grid)