Exemple #1
0
    def init_ui(self):
        self.layout = QVBoxLayout()

        self.setup_heading()

        self.button_group = QGroupBox()
        self.layout.addWidget(self.button_group)
        self.v_box = QVBoxLayout()
        self.button_group.setLayout(self.v_box)

        self.setup_voiceflow_login_button()
        self.setup_downloaded_voiceflow_button()

        back_button_creator = BackButton()
        self.back_button = back_button_creator.create_back_button()
        back_layout = back_button_creator.create_back_layout(self.back_button)

        self.v_box.addWidget(self.voiceflow_to_json_button)
        self.v_box.addWidget(QLabel())
        self.v_box.addWidget(self.json_file_button)
        self.v_box.addWidget(QLabel())
        self.v_box.addLayout(back_layout)

        self.setLayout(self.layout)
Exemple #2
0
    def init_ui(self):
        self.figure = plt.figure()
        self.canvas = FigureCanvas(self.figure)
        self.toolbar = NavigationToolbar(self.canvas, self)

        self.date = datetime.today()
        self.date = self.date.strftime('%Y-%m-%d')

        self.l1 = QLabel('Please choose the period of time for which to diplay the data: ')
        self.buttonDaily = QPushButton('daily')
        self.buttonMonthly = QPushButton('monthly')
        self.buttonPeriod = QPushButton('set period')

        self.buttonDaily.clicked.connect(self.daily)
        self.buttonMonthly.clicked.connect(self.monthly)
        self.buttonPeriod.clicked.connect(self.period)

        sublayoutTime = QHBoxLayout()
        sublayoutTime.addWidget(self.l1)
        sublayoutTime.addWidget(self.buttonDaily)
        sublayoutTime.addWidget(self.buttonMonthly)
        sublayoutTime.addWidget(self.buttonPeriod)
        sublayoutTime.setAlignment(Qt.AlignRight);

        self.l2 = QLabel('Select the date: ')
        self.l3 = QLabel('   Select the end date: ')

        self.dateedit = QDateEdit(calendarPopup=True)
        self.dateedit.setDateTime(QDateTime.currentDateTime())
        self.startDate = QDateEdit(calendarPopup=True)
        self.startDate.setDateTime(QDateTime.currentDateTime())
        self.endDate = QDateEdit(calendarPopup=True)
        self.endDate.setDateTime(QDateTime.currentDateTime())

        self.l3.hide()
        self.startDate.hide()
        self.endDate.hide()

        self.monthList = QDateEdit()
        self.monthList.setDisplayFormat("MMM")
        self.monthList.setDateTime(QDateTime.currentDateTime())
        self.monthList.hide()

        self.yearList = QDateEdit()
        self.yearList.setDisplayFormat("yyyy")
        self.yearList.setDateTime(QDateTime.currentDateTime())
        self.yearList.hide()

        self.l4 = QLabel("'Start date' should be before 'end date'!")
        self.l4.setStyleSheet("QWidget {color : rgba(255,0,0,255);}")
        self.l4.hide()

        sublayoutSelectDate = QHBoxLayout()
        sublayoutSelectDate.addWidget(self.l2)
        sublayoutSelectDate.addWidget(self.dateedit)
        sublayoutSelectDate.addWidget(self.monthList)
        sublayoutSelectDate.addWidget(self.yearList)
        sublayoutSelectDate.addWidget(self.startDate)
        sublayoutSelectDate.addWidget(self.l3)
        sublayoutSelectDate.addWidget(self.endDate)
        sublayoutSelectDate.setAlignment(Qt.AlignRight);

        self.button_show_layout = QHBoxLayout()
        self.buttonShow = QPushButton('Show Analytics')
        self.buttonShow.clicked.connect(self.update)
        self.button_show_layout.addWidget(QLabel())
        self.button_show_layout.addWidget(QLabel())
        self.button_show_layout.addWidget(self.buttonShow)

        sublayoutTimeSelect = QVBoxLayout()
        sublayoutTimeSelect.addLayout(sublayoutTime)
        sublayoutTimeSelect.addLayout(sublayoutSelectDate)
        sublayoutTimeSelect.addWidget(self.l4, alignment=Qt.AlignRight)
        sublayoutTimeSelect.addLayout(self.button_show_layout)

        self.button1 = QPushButton('Hourly Call Summary')
        self.button2 = QPushButton('Initial Calling Outcome')
        self.button3 = QPushButton('Redirected Calls')
        self.button4 = QPushButton('IVR Call Drop Rate')

        self.outcomes, self.time, self.redirect = return_daily_data(self.date)
        self.graph = 1
        self.period = 'daily'
        self.day = datetime.today().strftime('%d %B %Y')
        self.month = datetime.today().strftime('%B')
        self.year = datetime.today().strftime('%Y')
        self.fromDate = datetime.today().strftime('%d %B %Y')
        self.toDate = datetime.today().strftime('%d %B %Y')
        self.plot1()

        self.button1.clicked.connect(self.plot1)
        self.button2.clicked.connect(self.plot2)
        self.button3.clicked.connect(self.plot3)
        self.button4.clicked.connect(self.plot4)

        sublayout1 = QHBoxLayout()
        sublayout1.addWidget(self.button1)
        sublayout1.addWidget(self.button2)

        sublayout2 = QHBoxLayout()
        sublayout2.addWidget(self.button3)
        sublayout2.addWidget(self.button4)

        sublayout = QVBoxLayout()
        sublayout.addLayout(sublayout1)
        sublayout.addLayout(sublayout2)

        back_button_creator = BackButton()
        self.back_button = back_button_creator.create_back_button()
        back_layout = back_button_creator.create_back_layout(self.back_button)

        main_layout = QVBoxLayout()
        main_layout.addWidget(self.toolbar)
        main_layout.addLayout(sublayoutTimeSelect)
        main_layout.addWidget(self.canvas)
        main_layout.addLayout(sublayout)
        main_layout.addLayout(back_layout)

        self.setLayout(main_layout)