Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Miguel Ángel González Gallardo
/
AnalizadorLogs
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
066b4723
authored
May 07, 2021
by
Miguel Ángel González Gallardo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
tabla de ocurrencias de extensiones hecha
parent
b65bb615
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
codigo/Gui.py
codigo/TablaExtFrec.py
codigo/__pycache__/TablaExtFrec.cpython-39.pyc
codigo/Gui.py
View file @
066b4723
...
...
@@ -9,6 +9,7 @@ from eliminarComportamientoAutomatico_GUI import FiltrarComportamientoAutomatico
from
ObtenerMasVisitados
import
ObtenerMasVisitados
from
DirectoriosMasSolicitados_GUI
import
DirectoriosMasSol
from
AnalisisDuracionSesion
import
estadisticasDuracionSesiones
from
TablaExtFrec
import
TablaExtFrec
from
Dato
import
Dato
from
Filtros
import
getFormatosFromCSV
from
Filtros
import
eliminarComportamientoAutomatico
...
...
@@ -107,6 +108,10 @@ def fDurVis():
if
len
(
REG
)
>
0
:
getDuracionPrimerasVisitas
(
REG
)
def
extMasFrec
():
if
len
(
REG
)
>
0
:
TablaExtFrec
(
REG
)
def
barraMenu
(
ventana
):
# DEFINIR BARRA DE MENÚ DE LA APLICACION:
barramenu
=
Menu
(
ventana
)
...
...
@@ -139,6 +144,8 @@ def barraMenu(ventana):
underline
=
0
,
compound
=
RIGHT
)
menu2
.
add_command
(
label
=
'Duracion de primeras 2 visitas en cada sesion'
,
command
=
fDurVis
,
underline
=
0
,
compound
=
RIGHT
)
menu2
.
add_command
(
label
=
'Extensiones con mas ocurrencias'
,
command
=
extMasFrec
,
underline
=
0
,
compound
=
RIGHT
)
menu3
=
Menu
(
barramenu
)
barramenu
.
add_cascade
(
menu
=
menu3
,
label
=
'Cesta'
)
...
...
codigo/TablaExtFrec.py
0 → 100644
View file @
066b4723
import
tkinter
as
ttk
from
tkinter
import
ttk
from
tkinter
import
*
import
operator
class
TablaExtFrec
:
def
__init__
(
self
,
registros
):
#Obtengo las extensiones mas repetidas junto con su numero de ocurrencias
ext
=
{}
for
r
in
registros
:
if
'.'
in
r
.
URL_Solicitada
:
#Si tiene extension
#Saco la extension
c
=
len
(
r
.
URL_Solicitada
)
-
1
while
c
>
0
and
r
.
URL_Solicitada
[
c
]
!=
'.'
:
c
-=
1
extension
=
r
.
URL_Solicitada
[
c
:
len
(
r
.
URL_Solicitada
)]
if
extension
in
ext
:
#Si existe la extension en el diccionario
ext
[
extension
]
=
ext
[
extension
]
+
1
else
:
ext
[
extension
]
=
1
ext
=
sorted
(
ext
.
items
(),
key
=
operator
.
itemgetter
(
1
))
while
len
(
ext
)
>
10
:
# Me quedo con las 10 que mas tengan
ext
.
pop
(
0
)
self
.
v
=
Tk
()
self
.
v
.
resizable
(
0
,
0
)
self
.
v
.
title
(
"Extensiones mas frecuentes"
)
self
.
v
.
geometry
(
'300x400'
)
# Creo la tabla y relleno las cabeceras
self
.
tabla
=
ttk
.
Treeview
(
self
.
v
,
height
=
100
,
columns
=
[
f
"#{n}"
for
n
in
range
(
2
)])
scrollbar_vertical
=
ttk
.
Scrollbar
(
self
.
v
,
orient
=
'vertical'
,
command
=
self
.
tabla
.
yview
)
scrollbar_horizontal
=
ttk
.
Scrollbar
(
self
.
v
,
orient
=
'horizontal'
,
command
=
self
.
tabla
.
xview
)
scrollbar_vertical
.
pack
(
side
=
'right'
,
fill
=
Y
)
scrollbar_horizontal
.
pack
(
side
=
'bottom'
,
fill
=
X
)
self
.
tabla
.
configure
(
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
=
"Extension"
)
self
.
tabla
.
column
(
'#1'
,
width
=
150
,
anchor
=
CENTER
)
self
.
tabla
.
heading
(
'#2'
,
text
=
"Ocurrencias"
)
self
.
tabla
.
column
(
'#2'
,
width
=
150
,
anchor
=
CENTER
)
# Inserto los registros
self
.
tabla
.
delete
(
*
self
.
tabla
.
get_children
())
for
i
in
range
(
len
(
ext
)):
aux
=
[
ext
[
i
][
0
],
ext
[
i
][
1
]]
self
.
tabla
.
insert
(
""
,
'end'
,
values
=
aux
)
self
.
v
.
mainloop
()
\ No newline at end of file
codigo/__pycache__/TablaExtFrec.cpython-39.pyc
0 → 100644
View file @
066b4723
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment