Cesta transformada hecha y scrollbarr corregidos

parent 258b692b
from Gestor import FACTOR_UMBRAL
from Gestor import REG
class Cesta:
def __init__(self, directorios, sesiones, tam, i):
# Atributos
......
from datetime import datetime
# Definimos la clase dato con: Host Remoto, fecha, metodo de petición, url, protocolo, etc...
class Dato:
# Constructor por defecto para instanciarlo en GUI (No tocar)
......
import tkinter as ttk
from tkinter import *
from Cesta import obtenerDirectorios
from Gestor import FACTOR_UMBRAL
from Gestor import REG
class DirectoriosMasSol:
......@@ -17,10 +15,15 @@ class DirectoriosMasSol:
num_dir = len(d)
# Creo la tabla y relleno las cabeceras
self.tabla = ttk.Treeview(self.v, height=100, columns=[f"#{n}" for n in range(0, 4)])
self.tabla.grid_propagate(True)
scrollbar_vertical = ttk.Scrollbar(self.v, orient='vertical', command=self.tabla.yview)
scrollbar_vertical.pack(side='right', fill=Y)
self.tabla.configure( yscrollcommand=scrollbar_vertical.set)
self.tabla.pack(side=LEFT, fill=BOTH, expand=False)
self.tabla.config(show='headings')
self.tabla.grid(row=0, column=0, sticky='ns')
self.v.update()
#Cabeceras tabla
self.tabla.heading('#1', text="Directorio")
self.tabla.column('#1', width=200, anchor=CENTER)
......
......@@ -5,8 +5,8 @@ EXTENSIONES_NOADMITIDAS = []
UMBRAL_SESIONES = 1800
FACTOR_UMBRAL = 0.5
REG = []
'''
def printRegistro(registros):
print("RESULTADOS: ")
informe = (
......
......@@ -13,6 +13,8 @@ from Filtros import getFormatosFromCSV
from Filtros import eliminarComportamientoAutomatico
from VentanaAbrir import VentanaAbrir
from About_GUI import VentanaAbout
from TransfCesta import TransformarCesta
from Gestor import REG
......@@ -89,6 +91,11 @@ def fMasDSol():
if len(REG)>0:
v=DirectoriosMasSol(REG)
def fTransCest():
global REG
if len(REG) > 0:
v = TransformarCesta(REG)
def barraMenu(ventana):
# DEFINIR BARRA DE MENÚ DE LA APLICACION:
barramenu = Menu(ventana)
......@@ -123,6 +130,9 @@ def barraMenu(ventana):
menu3.add_command(label='Directorios Mas Solicitados',
command=fMasDSol,
underline=0, compound=RIGHT)
menu3.add_command(label='Cesta Transformada',
command=fTransCest,
underline=0, compound=RIGHT)
menu4 = Menu(barramenu)
barramenu.add_cascade(menu=menu4, label='Ayuda')
......@@ -162,10 +172,14 @@ for n in atributos:
# Creo la tabla y relleno las cabeceras
tabla = ttk.Treeview(ventana, height=100, columns=[f"#{n}" for n in range(0, len(nombresAtributos))])
tabla.grid_propagate(True)
scrollbar_vertical = ttk.Scrollbar(ventana, orient='vertical', command=tabla.yview)
scrollbar_vertical.pack(side='right', fill=Y)
tabla.configure( yscrollcommand=scrollbar_vertical.set)
tabla.pack(side=LEFT, fill=BOTH, expand=False)
tabla.config(show='headings')
tabla.grid(row=0, column=0, sticky='ns')
c = 0
ventana.update()
ancho = ventana.winfo_width()
......@@ -177,11 +191,6 @@ for i in nombresAtributos:
tabla.heading('#' + str(c) + '', text=nombresAtributos[0])
# Scrollbar
vsb = ttk.Scrollbar(ventana, orient="vertical", command=tabla.yview)
vsb.place(x=ancho - 15, y=25, height=ventana.winfo_height() - 35)
tabla.configure(yscrollcommand=vsb.set)
barraMenu(ventana)
ventana.mainloop()
import tkinter as ttk
from tkinter import *
from Cesta import obtenerDirectorios
from Cesta import obtenerCestaTransformada
from Gestor import FACTOR_UMBRAL
class TransformarCesta:
def __init__(self,reg):
# Se obtienen los directorios con contadores y la cesta
global FACTOR_UMBRAL
umbral = int(len(reg) * FACTOR_UMBRAL / 100)
d, cont, ses = obtenerDirectorios(reg)
num_dir = len(d)
# Obtiene cesta transformada y la muestra
cesta = obtenerCestaTransformada(d, ses)
#Creo ventana
self.v=Tk()
self.v.state('zoomed')
self.v.title("Cesta transformada")
self.v.geometry('800x600')
#Creo tabla
self.tabla = ttk.Treeview(self.v, height=100, columns=[f"#{n}" for n in range(0, len(d)+1)])
scrollbar_horizontal = ttk.Scrollbar(self.v, orient='horizontal', command=self.tabla.xview)
scrollbar_vertical = ttk.Scrollbar(self.v, orient='vertical', command=self.tabla.yview)
scrollbar_horizontal.pack(side='bottom', fill=X)
scrollbar_vertical.pack(side='right', fill=Y)
self.tabla.configure(xscrollcommand=scrollbar_horizontal.set, yscrollcommand=scrollbar_vertical.set)
self.tabla.pack(side=LEFT, fill=BOTH, expand=False)
self.tabla.config(show='headings')
self.v.update()
# Cabeceras tabla
self.tabla.heading('#1', text="Sesion")
self.tabla.column('#1', width=200, anchor=CENTER)
c=2
for i in d:
self.tabla.heading('#'+str(c), text=i)
self.tabla.column('#'+str(c), width=100, anchor=CENTER)
c+=1
#Insertar datos
self.tabla.delete(*self.tabla.get_children())
for c in cesta:
l=[c.sesion]
self.tabla.insert("", END, values=l+c.flags)
self.v.mainloop()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment