-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
88 lines (59 loc) · 2.49 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from kivy import require
require('1.9.0')
__version__ = '0.0.6'
from kivy.lang import Builder
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.image import Image
from netcat import get_network_ip
ABOUT = """
AndCat - netcat for Android
Version: {version}
Author: Matt / github.com/sirmackk
Logo credits: Iconka - https://www.iconfinder.com/icons/182515/cat_tied_yarn_icon
License: GPLv2
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
"""
kv_files = ('andcat', 'send_file', 'recv_file', 'about',)
for kv_file in kv_files:
Builder.load_file('kv_files/' + kv_file + '.kv')
class ScreenMan(ScreenManager):
version = __version__
about = ABOUT
class AndCatBtn(Button):
pass
class AndCatLabel(Label):
pass
class AndCatLogo(GridLayout):
def __init__(self, *args, **kwargs):
kwargs.setdefault('cols', 2)
kwargs.setdefault('rows', 1)
self.size_hint = (1, None,)
self.height = 50
super(self.__class__, self).__init__(*args, **kwargs)
self.create_and_add_widgets(kwargs.get('screen', ''))
def create_and_add_widgets(self, screen_label=''):
main_label = AndCatLabel(text='AndCat',
size_hint=(1.0, None,),
height=50)
logo_container = AnchorLayout(anchor_x='right')
logo_img = Image(source='logo.png', size_hint=(None, None,), width=50, height=50)
logo_container.add_widget(logo_img)
self.add_widget(main_label)
self.add_widget(logo_container)
class AndCatIPLabel(Label):
def get_own_ip(self):
return get_network_ip()
class AndCatGrid(GridLayout):
pass
class AndCatApp(App):
def build(self):
return ScreenMan()
if __name__ == '__main__':
AndCatApp().run()