Esempio n. 1
0
    def get_statistics(self, years, groupby, count):
        bd = Dados()
        
        # transforma os elementos de years activos em string
        filtered_years = self.filter_active(years)

        # transforma os elementos de groupby activos em string
        filtered_groupby = self.filter_active(groupby)
        
        # constroi o título a dar ao gráfico
        title = """Total number of {0} for years {1} grouped by {2}""".\
                    format(count + 's',
                           ','.join(['200' + str(i) for i in filtered_years]),
                           ','.join([str(i) for i in filtered_groupby]))
        
        # se tudo estiver bem gera gráfico
        data = bd.get_statistics(filtered_years, filtered_groupby, count)
        
        # adiciona a página à bd
        db = BaseDados()
        file_name = db.insert_custom_list(title, 1)
        
        # Cria a página HTML com a estatistica
        html = Html()
        html.create_statistics_page(title, data, filtered_groupby, file_name)
        
        # cria o ficheiro CSV
        csv = CriarCSV()
        csv.escrita_csv(title, file_name, data)
            
        # gera o gráfico
        graph = Graphs(data, title)
        
        pass
Esempio n. 2
0
    def get_lists(self, select, years):
        print "get_lists"
        # transforma os elementos de years activos em string
        filtered_years = self.filter_active(years)

        # transforma os elementos de groupby activos em string
        filtered_select = self.filter_active(select)
        
        # constroi o título a dar à lista
        title = """List of {0} for years {1}""".\
                    format(','.join([str(i) for i in filtered_select]),
                           ','.join(['200' + str(i) for i in filtered_years]))
        
        # retorna os dados da base de dados
        bd = Dados()
        data = bd.get_lists(filtered_select, filtered_years)
        
        # adiciona a página à bd
        db = BaseDados()
        file_name = db.insert_custom_list(title, 0)
        
        # cria o ficheiro CSV
        csv = CriarCSV()
        csv.escrita_csv(title, file_name, data)
        
        # Cria a página HTML com a estatistica
        html = Html()
        html.create_lists_page(title, data, filtered_select, file_name)
        pass
Esempio n. 3
0
    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""

        icon_path = ':/plugins/QgisLdsPlugin/icons/icon.png'
        self.add_action(
            icon_path,
            text=self.tr(u'Load LDS Data'),
            callback=self.run,
            parent=self.iface.mainWindow())
        
        
        # Should some of this be moved, Where Run?
        self.service_dlg = ServiceDialog() # RENAME
        self.stacked_widget = self.service_dlg.qStackedWidget
        self.list_options = self.service_dlg.uListOptions
        self.list_options.itemClicked.connect(self.showSelectedOption)
        self.list_options.itemClicked.emit(self.list_options.item(0))
        
        self.warning = self.service_dlg.uLabelWarning
        self.warning.setStyleSheet('color:red')
        
                
        item = QListWidgetItem("ALL")
        image_path = os.path.join(os.path.dirname(__file__), "icons", "OpenRaster.png")
        item.setIcon(QIcon(image_path))
        self.list_options.addItem(item)

        item = QListWidgetItem("WFS")
        image_path = os.path.join(os.path.dirname(__file__), "icons", "OpenRaster.png")
        item.setIcon(QIcon(image_path))
        self.list_options.addItem(item)

        item = QListWidgetItem("WMS")
        image_path = os.path.join(os.path.dirname(__file__), "icons", "OpenRaster.png")
        item.setIcon(QIcon(image_path))
        self.list_options.addItem(item)

        item = QListWidgetItem("WMTS")
        image_path = os.path.join(os.path.dirname(__file__), "icons", "OpenRaster.png")
        item.setIcon(QIcon(image_path))
        self.list_options.addItem(item)
        
        item = QListWidgetItem("Settings")
        image_path = os.path.join(os.path.dirname(__file__), "icons", "OpenRaster.png")
        item.setIcon(QIcon(image_path))
        self.list_options.addItem(item)

        item = QListWidgetItem("About")
        image_path = os.path.join(os.path.dirname(__file__), "icons", "OpenRaster.png")
        item.setIcon(QIcon(image_path))
        self.list_options.addItem(item)
        
        # add placeholder api key to ui
        self.showApiKey()
        
        #set table model
        self.setTableModelView()
        #set about html
        html = Html()
        self.service_dlg.hAboutHtml.setHtml(html.aboutHtml())
Esempio n. 4
0
def getHtml(urlNum, allUrlList, urlImgQueue, urlQueue):
    while (urlNum < 20 and urlQueue.not_empty):
        url = urlQueue.get()

        thisHtml = Html(url)
        html = thisHtml.getHtml()

        if (html != None):
            thisUrl = Url(html, allUrlList, urlQueue, urlImgQueue, urlNum)
            allUrlList, urlQueue, urlImgQueue, urlNum = thisUrl.getUrl()
Esempio n. 5
0
def getImg(allImgList, imgNum):
    localImgNum = 0
    while (localImgNum < 10 and urlImgQueue.not_empty):
        url = urlImgQueue.get()

        thisHtml = Html(url)
        html = thisHtml.getHtml()

        if (html != None):
            thisImg = Image(html, localImgNum, allImgList, imgNum)
            localImgNum, allImgList = thisImg.getImg()
Esempio n. 6
0
 def http_start_server(self, generate_html):
     
     # inicia o servidor
     self.http_server = HttpServer()
     self.http_server.start()
     
     if generate_html == True:
         
         # cria páginas
         html = Html()
         html.create_index()
     pass
Esempio n. 7
0
 def test_html_conatin_body_contain_p_output(self):
     p_value = "this p text"
     p_node = P(p_value)
     body_node = Body(p_node)
     html = Html(body_node)
     result = str(html)
     self.assertEqual("<html><body><p>this p text</p></body></html>",
                      result)
Esempio n. 8
0
        },
    ]

    x = db.tableFromDict('xyzzy', dl[0])
    db.dropTable('xyzzy')
    db.query(x)

    y = db.tableFromDict('myzzy', dl[0])
    db.dropTable('myzzy')
    db.query(y)

    x = db.persistDict('xyzzy', dl)
    y = db.persistDict('myzzy', dl)
    db.commit()

    c = db.cursor()
    print("Query:")
    for d in c.execute('select * from xyzzy;'):
        print(d)

    tbl = Html().entabulate(dl)
    print(tbl)

    print("Tables:")
    for t in db.tables():
        print(t)
        for v in db.variables(t, qualified=False):
            print("  %s" % v)

    db.close()
Esempio n. 9
0
 def test_html_contain_body_output(self):
     bodyvalue = "123"
     result = str(Html(Body(bodyvalue)))
     self.assertEqual("<html><body>123</body></html>", result)
Esempio n. 10
0
 def test_html_output(self):
     self.assertEqual("<html></html>", str(Html()))
Esempio n. 11
0
def main():
	HtmlObject = Html()
	HtmlObject.genHtml()