Skip to content

Commit 5a6a318

Browse files
committed
Version 1.0
0 parents  commit 5a6a318

29 files changed

+2001
-0
lines changed

.anvil_editor.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
unique_ids:
2+
forms: {Upload: 75YOFUMTVMY26NNWR6CTHOLWTKL3YDLD, Dashboard: ABBHSTIODNOLAYRHS5HMICZDLQCGGRWR,
3+
Delete: XBVRKGOOUAWYWKZKP5L7C476I6UTQV3N, History: QLAHZPJ33HHKKX6NXBZ4DW5XHDZXWFHX,
4+
List.ItemTemplateSeason.ItemTemplateEpisode: QHIDEGYAZDXALAE5DTQFFVMVMHK6YLLX,
5+
List.ItemTemplateSeason: NAEEYJMU2CZTPUGBPN7WAYTQKEKLMKCQ, List.ItemTemplateSeason.ItemTemplateEpisode.ItemTemplateAttachment: KIGIWSWVBDCMR66E4ISXXMMCBYGTLZBO,
6+
List: QR777JPFUMTEE4CIJZZIZEUMT2HS3IP5, List.ItemTemplateSeason.ItemTemplateEpisode.ItemTemplateAttachment.ItemTemplateVideo: 26NNCNEVZROETISET7BXV5F2SUZC6Z7D,
7+
Delete.ItemTemplateDelete: TZO4F5P5FNQB7GCC6S5SB3VSAYA5BKRG}
8+
modules: {}
9+
server_modules: {ServerModuleMicim: DT3JBOGOOCLKCRYLMJPT54Y56IZJF7PB}
10+
assets: {standard-page.html: KS4NM7B4ZWRH6W2EII4MCURZ5KJIQO73, theme.css: UDBY7LXN6ITTB55KMZV76YVYF6FJEZUW}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.pyc
2+
*.pyo
3+
__pycache__
4+
.anvil-data

__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# This repository is an Anvil app. Learn more at https://anvil.works/
3+
# To run the server-side code on your own machine, run:
4+
# pip install anvil-uplink
5+
# python -m anvil.run_app_via_uplink YourAppPackageName
6+
7+
__path__ = [__path__[0]+"/server_code", __path__[0]+"/client_code"]

anvil.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
dependencies:
2+
- app_id: BOJZK76FMAI3RVEZ
3+
version: {dev: false}
4+
services:
5+
- source: /runtime/services/tables.yml
6+
client_config: {}
7+
server_config: {auto_create_missing_columns: false}
8+
package_name: MayIComeInMadam
9+
allow_embedding: false
10+
name: MayIComeInMadam
11+
runtime_options: {version: 2, client_version: '3', server_version: python3-sandbox}
12+
metadata: {title: May I Come In Madam, description: Full-stack web app built with nothing but python with Anvil framework.}
13+
startup_form: Dashboard
14+
db_schema:
15+
- name: episodes
16+
id: 141748
17+
python_name: episodes
18+
columns:
19+
1Xeq9Zu7Y7I=:
20+
name: episode_list
21+
type: simpleObject
22+
admin_ui: {order: 1, width: 442}
23+
zpIRbBKu8X8=:
24+
name: session
25+
type: string
26+
admin_ui: {order: 0, width: 200}
27+
access: {python_name: episodes, app_id: 6QDX36P6FY2EWO4O, server: full, client: none,
28+
table_mapping_name: null, table_mapping_id: null, table_id: 141748}
29+
- name: admin
30+
id: 145108
31+
python_name: admin
32+
columns:
33+
1jLhYaSTPaI=:
34+
name: key
35+
type: string
36+
admin_ui: {order: 0, width: 200}
37+
_EuvL3UfsOw=:
38+
name: value
39+
type: string
40+
admin_ui: {order: 1, width: 200}
41+
access: {python_name: admin, app_id: 6QDX36P6FY2EWO4O, server: full, client: none,
42+
table_mapping_name: null, table_mapping_id: null, table_id: 145108}
43+
- name: sessions
44+
id: 142061
45+
python_name: sessions
46+
columns:
47+
ULLU8Oaxp0M=:
48+
name: session
49+
type: string
50+
admin_ui: {order: 0, width: 200}
51+
access: {python_name: sessions, app_id: 6QDX36P6FY2EWO4O, server: full, client: none,
52+
table_mapping_name: null, table_mapping_id: null, table_id: 142061}
53+
- name: history
54+
id: 142064
55+
python_name: history
56+
columns:
57+
0ZI7Upd7Zq4=:
58+
name: session
59+
type: string
60+
admin_ui: {order: 0, width: 200}
61+
hiaWx30OWvA=:
62+
name: updated
63+
type: datetime
64+
admin_ui: {order: 2, width: 200}
65+
tqUlHzNZyas=:
66+
name: episode
67+
type: simpleObject
68+
admin_ui: {order: 1, width: 200}
69+
access: {python_name: history, app_id: 6QDX36P6FY2EWO4O, server: full, client: none,
70+
table_mapping_name: null, table_mapping_id: null, table_id: 142064}
71+
renamed: true

client_code/Dashboard/__init__.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from ._anvil_designer import DashboardTemplate
2+
from anvil import *
3+
import anvil.tables as tables
4+
import anvil.tables.query as q
5+
from anvil.tables import app_tables
6+
import anvil.server
7+
from HashRouting import routing
8+
from ..List import List
9+
from ..Upload import Upload
10+
from ..History import History
11+
from ..Delete import Delete
12+
13+
@routing.main_router
14+
class Dashboard(DashboardTemplate):
15+
def __init__(self, **properties):
16+
# Set Form properties and Data Bindings.
17+
self.init_components(**properties)
18+
19+
# Any code you write here will run when the form opens.
20+
self.links = []
21+
# self.set_tag(self.link_list, 'list')
22+
self.set_tag(self.link_list, '')
23+
self.set_tag(self.link_history, 'history')
24+
self.set_tag(self.link_upload, 'upload')
25+
self.set_tag(self.link_delete, 'delete')
26+
# routing.set_url_hash('list')
27+
# print("init",properties)
28+
29+
def set_tag(self, link, *args):
30+
self.links.append(link)
31+
link.tag.url_hash = args[0]
32+
33+
def handle_nav_click(self, **event_args):
34+
"""This method is called when the link is clicked"""
35+
# print("hnc", event_args)
36+
routing.set_url_hash(event_args['sender'].tag.url_hash)
37+
38+
def on_navigation(self, **event_args):
39+
"""This method is called when the link is clicked"""
40+
# print("on",event_args)
41+
for link in self.links:
42+
if link.tag.url_hash == event_args.get('url_hash'):
43+
link.role = 'selected'
44+
self.label_title.text = link.text
45+
else:
46+
link.role = 'default'
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
is_package: true
2+
container:
3+
type: HtmlTemplate
4+
properties: {html: '@theme:standard-page.html'}
5+
components:
6+
- type: ColumnPanel
7+
properties: {}
8+
name: content_panel
9+
layout_properties: {slot: default}
10+
- type: FlowPanel
11+
properties: {}
12+
name: navbar_links
13+
layout_properties: {slot: nav-right}
14+
- type: ColumnPanel
15+
properties: {role: null, tooltip: '', border: '', foreground: '', visible: true,
16+
wrap_on: mobile, col_spacing: small, spacing_above: none, col_widths: '{}', spacing_below: none,
17+
background: ''}
18+
name: column_panel_nav
19+
layout_properties: {slot: left-nav}
20+
components:
21+
- type: Image
22+
properties: {role: null, vertical_align: top, height: '100', tooltip: '', border: '',
23+
foreground: '', visible: true, display_mode: fill_width, spacing_above: none,
24+
source: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQrPGqgM3ImTd6nyt1XWAj4rCmIszvRLE4AhN7ZYHS-5yLVxfrK3nSDy1Q6IPEQvxZzwK8&usqp=CAU',
25+
spacing_below: large, background: '', horizontal_align: center}
26+
name: image_1
27+
layout_properties: {grid_position: 'VZVAEZ,NPWVLB'}
28+
- type: Link
29+
properties: {role: null, url: '', align: left, tooltip: '', border: '', foreground: '',
30+
visible: true, text: May I Come In Madam, font_size: null, wrap_on: mobile,
31+
font: '', col_spacing: medium, spacing_above: large, icon_align: left, col_widths: '',
32+
spacing_below: small, italic: false, background: '', bold: false, underline: false,
33+
icon: ''}
34+
name: link_list
35+
layout_properties: {grid_position: 'ERXUYS,GCWCYI'}
36+
event_bindings: {click: handle_nav_click}
37+
- type: Link
38+
properties: {role: null, url: '', align: left, tooltip: '', border: '', foreground: '',
39+
visible: true, text: Watched Episodes, font_size: null, wrap_on: mobile, font: '',
40+
col_spacing: medium, spacing_above: small, icon_align: left, col_widths: '',
41+
spacing_below: small, italic: false, background: '', bold: false, underline: false,
42+
icon: ''}
43+
name: link_history
44+
layout_properties: {grid_position: 'OWDUQO,AMWKUK'}
45+
event_bindings: {click: handle_nav_click}
46+
- type: Link
47+
properties: {role: null, url: '', align: left, tooltip: '', border: '', foreground: '',
48+
visible: true, text: Upload, font_size: null, wrap_on: mobile, font: '', col_spacing: medium,
49+
spacing_above: small, icon_align: left, col_widths: '', spacing_below: small,
50+
italic: false, background: '', bold: false, underline: false, icon: ''}
51+
name: link_upload
52+
layout_properties: {grid_position: 'YPSYTE,VFIOTB'}
53+
event_bindings: {click: handle_nav_click}
54+
- type: Link
55+
properties: {role: null, url: '', align: left, tooltip: '', border: '', foreground: '',
56+
visible: true, text: Delete Season, font_size: null, wrap_on: mobile, font: '',
57+
col_spacing: medium, spacing_above: small, icon_align: left, col_widths: '',
58+
spacing_below: small, italic: false, background: '', bold: false, underline: false,
59+
icon: ''}
60+
name: link_delete
61+
layout_properties: {grid_position: 'YMBHUI,UHQXPY'}
62+
event_bindings: {click: handle_nav_click}
63+
- type: Label
64+
properties: {}
65+
name: label_title
66+
layout_properties: {slot: title}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from ._anvil_designer import ItemTemplateDeleteTemplate
2+
from anvil import *
3+
import anvil.server
4+
import anvil.tables as tables
5+
import anvil.tables.query as q
6+
from anvil.tables import app_tables
7+
8+
class ItemTemplateDelete(ItemTemplateDeleteTemplate):
9+
def __init__(self, **properties):
10+
# Set Form properties and Data Bindings.
11+
self.init_components(**properties)
12+
13+
# Any code you write here will run when the form opens.
14+
15+
def button_delete_click(self, **event_args):
16+
"""This method is called when the button is clicked"""
17+
if alert(f"Confirm deletion of {self.item['session']}",title='Delete Entire Season',buttons=[('Yes', True)]):
18+
self.parent.raise_event('x-delete', session=self.item)
19+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
container:
2+
type: ColumnPanel
3+
properties: {col_widths: '{}'}
4+
components:
5+
- type: ColumnPanel
6+
properties: {role: card, tooltip: '', border: '', foreground: '', visible: true,
7+
wrap_on: mobile, col_spacing: medium, spacing_above: small, col_widths: '{}',
8+
spacing_below: small, background: ''}
9+
name: card_delete
10+
layout_properties: {grid_position: 'ATFVOV,ITYZOL'}
11+
components:
12+
- type: FlowPanel
13+
properties: {role: null, spacing: medium, align: justify, tooltip: '', border: '',
14+
foreground: '', visible: true, spacing_above: small, spacing_below: small, background: ''}
15+
name: flow_panel_1
16+
layout_properties: {grid_position: 'HRONPX,YHHGJS'}
17+
components:
18+
- type: Label
19+
properties: {role: subheading, align: left, tooltip: '', border: '', foreground: '',
20+
visible: true, text: '', font_size: null, font: '', spacing_above: small,
21+
icon_align: left, spacing_below: small, italic: false, background: '', bold: false,
22+
underline: false, icon: ''}
23+
name: label_session
24+
layout_properties: {grid_position: 'HRONPX,HTPAIZ'}
25+
data_bindings:
26+
- {property: text, code: 'self.item[''session'']'}
27+
- type: Button
28+
properties: {role: secondary-color, align: center, tooltip: '', border: '',
29+
enabled: true, foreground: '', visible: true, text: '', font_size: null, font: '',
30+
spacing_above: small, icon_align: left, spacing_below: small, italic: false,
31+
background: '', bold: false, underline: false, icon: 'fa:trash'}
32+
name: button_delete
33+
layout_properties: {grid_position: 'HRONPX,YGBVST'}
34+
event_bindings: {click: button_delete_click}
35+
is_package: true

client_code/Delete/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from ._anvil_designer import DeleteTemplate
2+
from anvil import *
3+
import anvil.server
4+
import anvil.tables as tables
5+
import anvil.tables.query as q
6+
from anvil.tables import app_tables
7+
from HashRouting import routing
8+
9+
@routing.route('delete')
10+
class Delete(DeleteTemplate):
11+
def __init__(self, **properties):
12+
# Set Form properties and Data Bindings.
13+
self.init_components(**properties)
14+
15+
# Any code you write here will run when the form opens.
16+
self.repeating_panel_1.set_event_handler('x-delete', self.delete_item)
17+
self.refresh_list()
18+
19+
def refresh_list(self):
20+
self.repeating_panel_1.items = anvil.server.call('sessions')
21+
22+
23+
def delete_item(self, session, **args):
24+
if anvil.server.call('delete_session', session):
25+
self.refresh_list()
26+
routing.clear_cache()
27+
else:
28+
Notification('Failed to delete. Maybe you are unauthorized to delete.').show()

client_code/Delete/form_template.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
container:
2+
type: ColumnPanel
3+
properties: {col_widths: '{}'}
4+
components:
5+
- type: RepeatingPanel
6+
properties: {item_template: Delete.ItemTemplateDelete}
7+
name: repeating_panel_1
8+
layout_properties: {grid_position: 'OHWWCK,IPWIQG'}
9+
is_package: true

0 commit comments

Comments
 (0)