Ejemplo n.º 1
0
 def go_pressed(self):
     # if not self.dropArea.getImage().isNull():
     # run_detection(self.textbox.displayText())
     # self.dialog = ResultsView('tmp.jpg')
     # self.dialog.show()
     self.dialog = ResultsView('gui/lined_img.png', 'gui/info.txt')
     self.dialog.show()
Ejemplo n.º 2
0
    def test_render(self):
        result = {"oleg": 5, "ivan": 6}
        template = "{{#heroes}}{{name}},{{count}}:{{/heroes}}{{today}}"
        date = datetime.date(2010, 1, 1)

        self.assertEqual("ivan,6:oleg,5:2010-01-01",
                         ResultsView(date).render(result, template))
    def setupUi(self, Form):
        Form.setObjectName(_fromUtf8("Form"))
        Form.resize(610, 553)
        self.verticalLayout = QtGui.QVBoxLayout(Form)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName(_fromUtf8("label"))
        self.horizontalLayout.addWidget(self.label)
        self.adv_search_builder = QtGui.QToolButton(Form)
        self.adv_search_builder.setObjectName(_fromUtf8("adv_search_builder"))
        self.horizontalLayout.addWidget(self.adv_search_builder)
        self.query = HistoryLineEdit(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.query.sizePolicy().hasHeightForWidth())
        self.query.setSizePolicy(sizePolicy)
        self.query.setObjectName(_fromUtf8("query"))
        self.horizontalLayout.addWidget(self.query)
        self.search = QtGui.QPushButton(Form)
        self.search.setObjectName(_fromUtf8("search"))
        self.horizontalLayout.addWidget(self.search)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.results_view = ResultsView(Form)
        self.results_view.setAlternatingRowColors(True)
        self.results_view.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
        self.results_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.results_view.setRootIsDecorated(False)
        self.results_view.setUniformRowHeights(True)
        self.results_view.setItemsExpandable(False)
        self.results_view.setSortingEnabled(True)
        self.results_view.setExpandsOnDoubleClick(False)
        self.results_view.setObjectName(_fromUtf8("results_view"))
        self.results_view.header().setStretchLastSection(False)
        self.verticalLayout.addWidget(self.results_view)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout_2.addWidget(self.label_2)
        self.enable_all = QtGui.QPushButton(Form)
        self.enable_all.setObjectName(_fromUtf8("enable_all"))
        self.horizontalLayout_2.addWidget(self.enable_all)
        self.enable_none = QtGui.QPushButton(Form)
        self.enable_none.setObjectName(_fromUtf8("enable_none"))
        self.horizontalLayout_2.addWidget(self.enable_none)
        self.enable_invert = QtGui.QPushButton(Form)
        self.enable_invert.setObjectName(_fromUtf8("enable_invert"))
        self.horizontalLayout_2.addWidget(self.enable_invert)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_2.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout_2)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
Ejemplo n.º 4
0
async def main():
    result = Counter()
    async for message in client.iter_messages(
            await chat_id(), filter=InputMessagesFilterPhotoVideo):
        result[message.post_author] += 1
    async for message in client.iter_messages(
            await chat_id(), filter=InputMessagesFilterRoundVideo):
        result[message.post_author] += 1

    ResultsHistory().save(result)
    ResultsS3(BUCKET_NAME).upload(ResultsView().render(result))
Ejemplo n.º 5
0
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(872, 610)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(I("store.png"))),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        Dialog.setSizeGripEnabled(True)
        self.verticalLayout_5 = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.top_layout = QtGui.QHBoxLayout()
        self.top_layout.setObjectName(_fromUtf8("top_layout"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setObjectName(_fromUtf8("label"))
        self.top_layout.addWidget(self.label)
        self.adv_search_button = QtGui.QToolButton(Dialog)
        self.adv_search_button.setObjectName(_fromUtf8("adv_search_button"))
        self.top_layout.addWidget(self.adv_search_button)
        self.search_edit = HistoryLineEdit(Dialog)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.search_edit.sizePolicy().hasHeightForWidth())
        self.search_edit.setSizePolicy(sizePolicy)
        self.search_edit.setObjectName(_fromUtf8("search_edit"))
        self.top_layout.addWidget(self.search_edit)
        self.search = QtGui.QPushButton(Dialog)
        self.search.setObjectName(_fromUtf8("search"))
        self.top_layout.addWidget(self.search)
        self.verticalLayout_5.addLayout(self.top_layout)
        self.store_splitter = QtGui.QSplitter(Dialog)
        self.store_splitter.setOrientation(QtCore.Qt.Horizontal)
        self.store_splitter.setObjectName(_fromUtf8("store_splitter"))
        self.groupBox = QtGui.QGroupBox(self.store_splitter)
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox)
        self.verticalLayout_2.setSpacing(0)
        self.verticalLayout_2.setMargin(0)
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.store_list = QtGui.QScrollArea(self.groupBox)
        self.store_list.setWidgetResizable(True)
        self.store_list.setObjectName(_fromUtf8("store_list"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 193, 127))
        self.scrollAreaWidgetContents.setObjectName(
            _fromUtf8("scrollAreaWidgetContents"))
        self.store_list.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_2.addWidget(self.store_list)
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.select_all_stores = QtGui.QPushButton(self.groupBox)
        self.select_all_stores.setObjectName(_fromUtf8("select_all_stores"))
        self.verticalLayout.addWidget(self.select_all_stores)
        self.select_invert_stores = QtGui.QPushButton(self.groupBox)
        self.select_invert_stores.setObjectName(
            _fromUtf8("select_invert_stores"))
        self.verticalLayout.addWidget(self.select_invert_stores)
        self.select_none_stores = QtGui.QPushButton(self.groupBox)
        self.select_none_stores.setObjectName(_fromUtf8("select_none_stores"))
        self.verticalLayout.addWidget(self.select_none_stores)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        self.verticalLayoutWidget = QtGui.QWidget(self.store_splitter)
        self.verticalLayoutWidget.setObjectName(
            _fromUtf8("verticalLayoutWidget"))
        self.verticalLayout_4 = QtGui.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout_4.setMargin(0)
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.results_view = ResultsView(self.verticalLayoutWidget)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.results_view.sizePolicy().hasHeightForWidth())
        self.results_view.setSizePolicy(sizePolicy)
        self.results_view.setMinimumSize(QtCore.QSize(0, 0))
        self.results_view.setAlternatingRowColors(True)
        self.results_view.setIconSize(QtCore.QSize(32, 32))
        self.results_view.setRootIsDecorated(False)
        self.results_view.setUniformRowHeights(False)
        self.results_view.setItemsExpandable(False)
        self.results_view.setSortingEnabled(True)
        self.results_view.setExpandsOnDoubleClick(False)
        self.results_view.setObjectName(_fromUtf8("results_view"))
        self.results_view.header().setStretchLastSection(False)
        self.verticalLayout_4.addWidget(self.results_view)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.configure = QtGui.QToolButton(self.verticalLayoutWidget)
        self.configure.setObjectName(_fromUtf8("configure"))
        self.horizontalLayout.addWidget(self.configure)
        self.open_external = QtGui.QCheckBox(self.verticalLayoutWidget)
        self.open_external.setObjectName(_fromUtf8("open_external"))
        self.horizontalLayout.addWidget(self.open_external)
        spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout_4.addLayout(self.horizontalLayout)
        self.verticalLayout_5.addWidget(self.store_splitter)
        self.bottom_layout = QtGui.QHBoxLayout()
        self.bottom_layout.setObjectName(_fromUtf8("bottom_layout"))
        self.label_2 = QtGui.QLabel(Dialog)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.bottom_layout.addWidget(self.label_2)
        self.total = QtGui.QLabel(Dialog)
        self.total.setObjectName(_fromUtf8("total"))
        self.bottom_layout.addWidget(self.total)
        spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding,
                                        QtGui.QSizePolicy.Minimum)
        self.bottom_layout.addItem(spacerItem1)
        self.close = QtGui.QPushButton(Dialog)
        self.close.setObjectName(_fromUtf8("close"))
        self.bottom_layout.addWidget(self.close)
        self.verticalLayout_5.addLayout(self.bottom_layout)

        self.retranslateUi(Dialog)
        QtCore.QObject.connect(self.close,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               Dialog.accept)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        Dialog.setTabOrder(self.search_edit, self.search)
        Dialog.setTabOrder(self.search, self.results_view)
        Dialog.setTabOrder(self.results_view, self.store_list)
        Dialog.setTabOrder(self.store_list, self.select_all_stores)
        Dialog.setTabOrder(self.select_all_stores, self.select_invert_stores)
        Dialog.setTabOrder(self.select_invert_stores, self.select_none_stores)
        Dialog.setTabOrder(self.select_none_stores, self.configure)
        Dialog.setTabOrder(self.configure, self.open_external)
        Dialog.setTabOrder(self.open_external, self.close)
        Dialog.setTabOrder(self.close, self.adv_search_button)
Ejemplo n.º 6
0
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(872, 610)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(I("store.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        Dialog.setWindowIcon(icon)
        Dialog.setSizeGripEnabled(True)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.search_title = HistoryLineEdit2(Dialog)
        self.search_title.setClearButtonEnabled(True)
        self.search_title.setObjectName("search_title")
        self.gridLayout.addWidget(self.search_title, 0, 2, 1, 1)
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 1, 0, 1, 2)
        self.search_author = HistoryLineEdit2(Dialog)
        self.search_author.setClearButtonEnabled(True)
        self.search_author.setObjectName("search_author")
        self.gridLayout.addWidget(self.search_author, 1, 2, 1, 1)
        self.adv_search_button = QtWidgets.QToolButton(Dialog)
        self.adv_search_button.setObjectName("adv_search_button")
        self.gridLayout.addWidget(self.adv_search_button, 2, 0, 1, 1)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 2, 1, 1, 1)
        self.search_edit = HistoryLineEdit2(Dialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.search_edit.sizePolicy().hasHeightForWidth())
        self.search_edit.setSizePolicy(sizePolicy)
        self.search_edit.setClearButtonEnabled(True)
        self.search_edit.setObjectName("search_edit")
        self.gridLayout.addWidget(self.search_edit, 2, 2, 1, 1)
        self.store_splitter = QtWidgets.QSplitter(Dialog)
        self.store_splitter.setOrientation(QtCore.Qt.Horizontal)
        self.store_splitter.setObjectName("store_splitter")
        self.groupBox = QtWidgets.QGroupBox(self.store_splitter)
        self.groupBox.setObjectName("groupBox")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox)
        self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_2.setSpacing(0)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.store_list = QtWidgets.QScrollArea(self.groupBox)
        self.store_list.setWidgetResizable(True)
        self.store_list.setObjectName("store_list")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 205, 147))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.store_list.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout_2.addWidget(self.store_list)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.select_all_stores = QtWidgets.QPushButton(self.groupBox)
        self.select_all_stores.setObjectName("select_all_stores")
        self.verticalLayout.addWidget(self.select_all_stores)
        self.select_invert_stores = QtWidgets.QPushButton(self.groupBox)
        self.select_invert_stores.setObjectName("select_invert_stores")
        self.verticalLayout.addWidget(self.select_invert_stores)
        self.select_none_stores = QtWidgets.QPushButton(self.groupBox)
        self.select_none_stores.setObjectName("select_none_stores")
        self.verticalLayout.addWidget(self.select_none_stores)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        self.verticalLayoutWidget = QtWidgets.QWidget(self.store_splitter)
        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
        self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.results_view = ResultsView(self.verticalLayoutWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.results_view.sizePolicy().hasHeightForWidth())
        self.results_view.setSizePolicy(sizePolicy)
        self.results_view.setMinimumSize(QtCore.QSize(0, 0))
        self.results_view.setAlternatingRowColors(True)
        self.results_view.setIconSize(QtCore.QSize(32, 32))
        self.results_view.setRootIsDecorated(False)
        self.results_view.setUniformRowHeights(False)
        self.results_view.setItemsExpandable(False)
        self.results_view.setSortingEnabled(True)
        self.results_view.setExpandsOnDoubleClick(False)
        self.results_view.setObjectName("results_view")
        self.results_view.header().setStretchLastSection(False)
        self.verticalLayout_4.addWidget(self.results_view)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.configure = QtWidgets.QToolButton(self.verticalLayoutWidget)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(I("config.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.configure.setIcon(icon1)
        self.configure.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.configure.setObjectName("configure")
        self.horizontalLayout.addWidget(self.configure)
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.open_external = QtWidgets.QCheckBox(self.verticalLayoutWidget)
        self.open_external.setObjectName("open_external")
        self.horizontalLayout.addWidget(self.open_external)
        self.verticalLayout_4.addLayout(self.horizontalLayout)
        self.gridLayout.addWidget(self.store_splitter, 3, 0, 1, 4)
        self.label_4 = QtWidgets.QLabel(Dialog)
        self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_4.setObjectName("label_4")
        self.gridLayout.addWidget(self.label_4, 0, 1, 1, 1)
        self.button_layout = QtWidgets.QVBoxLayout()
        self.button_layout.setObjectName("button_layout")
        self.widget = QtWidgets.QWidget(Dialog)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth())
        self.widget.setSizePolicy(sizePolicy)
        self.widget.setBaseSize(QtCore.QSize(24, 24))
        self.widget.setObjectName("widget")
        self.button_layout.addWidget(self.widget)
        self.search = QtWidgets.QPushButton(Dialog)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(I("search.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.search.setIcon(icon2)
        self.search.setObjectName("search")
        self.button_layout.addWidget(self.search)
        self.gridLayout.addLayout(self.button_layout, 0, 3, 3, 1)
        self.bottom_layout = QtWidgets.QHBoxLayout()
        self.bottom_layout.setObjectName("bottom_layout")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setObjectName("label_2")
        self.bottom_layout.addWidget(self.label_2)
        self.total = QtWidgets.QLabel(Dialog)
        self.total.setObjectName("total")
        self.bottom_layout.addWidget(self.total)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.bottom_layout.addItem(spacerItem1)
        self.close = QtWidgets.QPushButton(Dialog)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(I("window-close.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.close.setIcon(icon3)
        self.close.setObjectName("close")
        self.bottom_layout.addWidget(self.close)
        self.gridLayout.addLayout(self.bottom_layout, 4, 0, 1, 4)
        self.label_3.setBuddy(self.search_author)
        self.label.setBuddy(self.search_edit)
        self.label_4.setBuddy(self.search_title)

        self.retranslateUi(Dialog)
        self.close.clicked.connect(Dialog.accept)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
        Dialog.setTabOrder(self.search_title, self.search_author)
        Dialog.setTabOrder(self.search_author, self.adv_search_button)
        Dialog.setTabOrder(self.adv_search_button, self.search_edit)
        Dialog.setTabOrder(self.search_edit, self.search)
        Dialog.setTabOrder(self.search, self.store_list)
        Dialog.setTabOrder(self.store_list, self.select_all_stores)
        Dialog.setTabOrder(self.select_all_stores, self.select_invert_stores)
        Dialog.setTabOrder(self.select_invert_stores, self.select_none_stores)
        Dialog.setTabOrder(self.select_none_stores, self.results_view)
        Dialog.setTabOrder(self.results_view, self.configure)
        Dialog.setTabOrder(self.configure, self.open_external)
        Dialog.setTabOrder(self.open_external, self.close)