-
-
Notifications
You must be signed in to change notification settings - Fork 74
Inquisitive Investigators #5
Changes from all commits
e14c423
d96928b
2e9859c
7b3c1b1
217fca6
72e4ccb
c7cde08
8519d81
1cf9b4a
469b1eb
d613f13
f14fcbd
f74aa2a
e671f25
387bc7c
2ff56a2
20b2893
2128bee
65e5f5c
a6675ab
d56d768
d902bc5
53eb633
5efb042
0213224
0de0620
5ebe110
526aa9c
1688091
98c340d
b6bcbd1
d9caba5
423801c
40f1030
97e934b
49d1866
4a28f9b
dfe9fb4
34d7da0
4e79c3b
a88e5a1
8c262e2
32a50b8
284f7c6
6b3d31a
50f10dd
2b3828b
b216524
30de813
dde6dfd
2d38815
8cd0f6f
a970f8b
03dab19
b6bb61d
fc933c9
4b38185
c428cf7
59208be
7b9d384
839f552
b61a33c
f508b13
1760899
4771bc6
cdd1c17
0a48d25
22c5add
e8c3ee6
da199fb
a5d37b5
f070617
a13f05d
c6e6c06
7227b4e
064945a
341367a
780cd72
c559f6b
96f412f
014e7b6
fd6155e
ba734db
3856830
13a4a9b
772c2b1
42719ab
9ae9456
4f98c02
27b7db2
8d0518b
a5be694
ea98889
36faac2
e1cf551
94ede91
4aadebb
ac99f8b
9fce342
587c084
8eb5e88
ec9326b
608e138
2b5f1fd
a0f3760
244e96a
1d11cde
4b32a07
54705a3
acc95ce
aa28848
271f68b
cb7a18d
45df3e2
0b36697
7ee296b
bd026b7
914ff51
a8356fe
2c3f603
227d164
ff717e5
4c7738f
1cbd9aa
540a1ae
fdc303e
a6aa9a2
d37d480
7f39529
ca36b6d
ef821b3
7d4c075
f20ec77
5462a4c
1ec761a
058a45c
2c63e49
fe0498b
9ba44eb
4dc45e7
e9d4623
0ffb560
2a6c416
bc90285
a34002c
0fe2891
0efd5f4
121c12a
637ab2d
cff4402
10f5f1c
f5b6fa6
746b458
e1e7777
008a716
6726f9a
cd8b338
73d6d22
dd54147
84d8bdf
08a6a68
178db83
cb91591
30bc038
b498351
a817222
29b4a8c
9fff68d
b78ca4f
c0c1c6b
a6b98b9
5e8189e
10e8ee6
8e849c6
f15bd31
e3a44d9
3edad38
ac9c5f6
c4b8797
108f741
5aebc5c
465914a
5c44c29
1eff6e6
f83efda
d109d3d
0a56bb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[flake8] | ||
max-line-length=100 | ||
exclude=.cache,.venv,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox | ||
[flake8] | ||
max-line-length=100 | ||
exclude=.cache,.venv,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: flake8 | ||
name: Flake8 | ||
entry: pipenv run lint | ||
language: python | ||
types: [python] | ||
require_serial: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
flake8 = "*" | ||
pre-commit = "*" | ||
flake8-bugbear = "*" | ||
pylint = "*" | ||
|
||
[packages] | ||
kivy = "*" | ||
kivy-deps-sdl2 = "*" | ||
kivy-deps-glew = "*" | ||
|
||
[requires] | ||
python_version = "3.7" | ||
|
||
[scripts] | ||
lint = "python -m flake8" | ||
precommit = "pre-commit install" |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,38 @@ | ||
# Inquisitive Investigators | ||
|
||
Please use this README to document your team's project. Make sure to include a general description, information on how to set-up and run your project, and anything else you think may be interesting for a README. The README is usually the first document people read when they visit a project on GitHub, so it's a good idea to make it appealing. | ||
|
||
## Useful links | ||
|
||
- **Code Jam Rules:** [https://pythondiscord.com/pages/code-jams/code-jam-6/rules/](https://pythondiscord.com/pages/code-jams/code-jam-6/rules/) | ||
|
||
- **General Code Jam info:** [https://pythondiscord.com/pages/code-jams/code-jam-6/](https://pythondiscord.com/pages/code-jams/code-jam-6/) | ||
|
||
- **Kivy:** [https://kivy.org/#home](https://kivy.org/#home) | ||
|
||
## License | ||
|
||
All projects will merged into our Code Jam repository, which uses the [MIT license](../LICENSE). Please make sure that if you add assets, the licenses of those assets are compatible with the MIT license. | ||
# Rex Explorer - Inquisitive Investigators | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good readme. |
||
 | ||
|
||
## About | ||
|
||
Hello and thanks for using Rex-Explorer! Made over the course of a week for CodeJam VI, Rex-Explorer is a TUI file explorer with a built in terminal and many other features! | ||
|
||
#### Features | ||
- Be able to experience what it was like to browse files and directories on your computer from the old days! | ||
|
||
- A built in terminal? Yeah we were suprised too! Be able to change directories and even commit your own project to github! | ||
|
||
- A built in editor too! What, did you just want to look at your files. See what it was like to edit files back in the old'n days! | ||
|
||
- A built in photo viewer!? We added this in at the absolute last minute, and it's a great addition to the program. | ||
|
||
- Create files and directories to utilize with the built in editor, terminal and file explorer. | ||
|
||
- Rename and Copy files and directories across your browser. | ||
|
||
## Installation | ||
|
||
#### Users | ||
|
||
- Install pipenv: `pip install pipenv` | ||
- Install dependencies: `pipenv sync` | ||
- Run the program: `python -m rex_explorer` | ||
|
||
#### Developers | ||
|
||
- Install pipenv: `pip install pipenv` | ||
- Install dependencies: `pipenv sync --dev` | ||
|
||
## License | ||
|
||
The font we used is licensed under the [SIL Open Font Licesnse](https://www.fontspace.com/help/#license-17) | ||
|
||
[](#) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .core.main import AncientTechApp | ||
|
||
if __name__ == "__main__": | ||
AncientTechApp().run() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file was planned for use, but we ran out of time | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be removed in that case. |
||
|
||
from kivy.event import EventDispatcher | ||
|
||
|
||
class Controller(EventDispatcher): | ||
__events__ = ( | ||
'on_update', | ||
'on_edit' | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#:kivy 1.11.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good usage of Kivy language! |
||
#:import NoTransition kivy.uix.screenmanager.NoTransition | ||
|
||
<ScreenManager>: | ||
transition: NoTransition() | ||
|
||
<BrowserScreen>: | ||
name: browser | ||
Browser: | ||
id: browser | ||
|
||
<Browser>: | ||
left_browser: left | ||
right_browser: right | ||
terminal: terminal | ||
footer: footer | ||
|
||
FileBrowser: | ||
id: left | ||
pos_hint: {'top': 1} | ||
size_hint: .499,.8 | ||
FileBrowser: | ||
id: right | ||
pos_hint: {'top': 1,'right':1} | ||
size_hint: .499,.8 | ||
Border: | ||
pos_hint: {'top': .2} | ||
size_hint: 1,.01 | ||
Terminal: | ||
id: terminal | ||
pos_hint: {'top': .19} | ||
size_hint: 1,.15 | ||
Footer: | ||
id: footer | ||
pos_hint: {'top': .04} | ||
size_hint: 1,.04 | ||
|
||
<Button>: | ||
font_name: './rex_explorer/static/retro_font.ttf' | ||
font_size: 11.5 | ||
background_normal: '' | ||
background_color: (0,0,0,0) | ||
|
||
<Label>: | ||
font_name: './rex_explorer/static/retro_font.ttf' | ||
font_size: 11.5 | ||
|
||
<Border>: | ||
canvas.before: | ||
Color: | ||
rgb: 0.34,1,1 | ||
Rectangle: | ||
size: root.size | ||
pos: root.pos | ||
|
||
<TextInput>: | ||
canvas.before: | ||
Color: | ||
rgba: | ||
((1,1,1,1) | ||
if self.focus and not self._cursor_blink | ||
else (0, 0, 0, 0)) | ||
Rectangle: | ||
pos: self._cursor_visual_pos | ||
size: root.cursor_width + 10, -self._cursor_visual_height | ||
Color: | ||
rgba: self.disabled_foreground_color if self.disabled else (self.hint_text_color if not self.text else self.foreground_color) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# This file was planned for use, but we ran out of time | ||
|
||
from typing import Any, Dict, List, Union | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good import grouping. |
||
|
||
from kivy.uix.screenmanager import Screen | ||
from kivy.uix.floatlayout import FloatLayout | ||
from kivy.properties import ObjectProperty | ||
|
||
from .controller import Controller | ||
from .exceptions import InvalidBrowser | ||
|
||
|
||
class BrowserScreen(Screen): | ||
pass | ||
|
||
|
||
class Browser(FloatLayout, Controller): | ||
left_browser = ObjectProperty() | ||
right_browser = ObjectProperty() | ||
terminal = ObjectProperty() | ||
footer = ObjectProperty() | ||
|
||
def __init__(self, *args: Any, **kwargs: Any) -> None: | ||
super(Browser, self).__init__(*args, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is legacy syntax, should be |
||
|
||
def on_update( | ||
self, browser_side: str, | ||
state: int, files: List[str] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty minor, but this would be clearer with 1 argument per line, especially with the type hints adding noise. |
||
) -> None: | ||
if browser_side == 'left': | ||
browser = self.left_browser | ||
|
||
elif browser_side == 'right': | ||
browser = self.right_browser | ||
|
||
else: | ||
raise InvalidBrowser( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not fully convinced this needs it's own exception. A |
||
'Browser position should be either "left" or "right"' | ||
) | ||
|
||
browser.recycle_view.update(state, files) | ||
|
||
def on_edit(self) -> None: | ||
pass | ||
|
||
def get_headers(self) -> Dict[ | ||
str, Union[str, None] | ||
]: | ||
""" | ||
Returns current directory headers | ||
from each browser. | ||
""" | ||
return { | ||
'left': self.left_browser.header.directory.text, | ||
'right': self.right_browser.header.directory.text, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class InvalidBrowser(Exception): | ||
pass | ||
|
||
|
||
class InvalidSelection(Exception): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from kivy import Config | ||
|
||
Config.set('kivy', 'window_icon', 'rex_explorer/static/icon.ico') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be converted to a local config file. https://kivy.org/doc/stable/guide/config.html#local-configuration |
||
Config.set('input', 'mouse', 'mouse,multitouch_on_demand') | ||
Config.set('kivy', 'exit_on_escape', '0') | ||
Config.set('graphics', 'minimum_width', '1300') | ||
Config.set('graphics', 'minimum_height', '650') | ||
Config.set('graphics', 'width', '1300') | ||
Config.set('graphics', 'height', '650') | ||
|
||
from kivy.app import App | ||
from kivy.lang import Builder | ||
from kivy.uix.screenmanager import ScreenManager | ||
|
||
from .core import BrowserScreen | ||
from ..footer.footer import Footer | ||
from ..terminal.terminal import Terminal | ||
from ..manager.browser import FileBrowser | ||
from ..editor.editor import TextEditor | ||
from ..photo_viewer.viewer import PhotoViewer | ||
from ..utils.paths import CORE_KV | ||
|
||
Builder.load_file(CORE_KV) | ||
|
||
|
||
class Manager(ScreenManager): | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(Manager, self).__init__(*args, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Legacy syntax. |
||
self.add_widget(BrowserScreen(name='browser')) | ||
self.add_widget(TextEditor(name='text_editor')) | ||
self.add_widget(PhotoViewer(name='photo_viewer')) | ||
|
||
|
||
class AncientTechApp(App): | ||
|
||
def build(self): | ||
self.title = 'Rex Explorer' | ||
return Manager() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#:kivy 1.11.1 | ||
|
||
<TextEditor>: | ||
editor: editor | ||
recycler: recycler | ||
BoxLayout: | ||
RecycleView: | ||
effect_cls: "ScrollEffect" | ||
viewclass: 'EditorIO' | ||
id: recycler | ||
|
||
EditorIO: | ||
id: editor | ||
root: root | ||
font_name: './rex_explorer/static/retro_font.ttf' | ||
font_size: 12 | ||
foreground_color: root.foreground_color | ||
background_color: root.background_color | ||
height: max(self.parent.height, self.minimum_height) | ||
size_hint_y: None | ||
F: | ||
size_hint: 1,.05 | ||
|
||
|
||
|
||
<SavePopup>: | ||
title: 'Save File?' | ||
FloatLayout: | ||
Label: | ||
id: file | ||
size_hint: .3,.1 | ||
pos_hint: {'center_x': .5, 'center_y': .7} | ||
color: 0.34,1,1,1 | ||
Button: | ||
size_hint: .3,.1 | ||
pos_hint: {'center_x': .3, 'center_y': .4} | ||
text: '[ Save ]' | ||
color: 0.34,1,1,1 | ||
on_press: root.save() | ||
Button: | ||
size_hint: .3,.1 | ||
pos_hint: {'center_x': .7, 'center_y': .4} | ||
text: '[ Cancel ]' | ||
color: 0.34,1,1,1 | ||
on_press: root.dismiss() | ||
|
||
<F>: | ||
canvas: | ||
Color: | ||
rgba: 0,0,0,.5 | ||
Rectangle: | ||
size: self.size | ||
pos: self.pos | ||
BoxLayout: | ||
orientation: 'horizontal' | ||
Label: | ||
text: 'ESC: Exit' | ||
Label: | ||
text: 'CTRL + S: Save' | ||
Label: | ||
text: 'CTRL +/-: Zoom In/Out' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import Any | ||
|
||
from kivy.lang import Builder | ||
from kivy.uix.floatlayout import FloatLayout | ||
from kivy.uix.screenmanager import Screen | ||
from kivy.properties import ( | ||
ObjectProperty, | ||
StringProperty, | ||
NumericProperty, | ||
ColorProperty | ||
) | ||
|
||
from .editorIO import EditorIO | ||
from ..utils.paths import EDITOR_KV, FONT | ||
|
||
Builder.load_file(EDITOR_KV) | ||
|
||
|
||
class TextEditor(Screen): | ||
editor = ObjectProperty() | ||
recycler = ObjectProperty() | ||
|
||
foreground_color = ColorProperty((1, 1, 1, 1)) | ||
background_color = ColorProperty((0, 0, 0, 1)) | ||
|
||
font_name = StringProperty(FONT) | ||
font_size = NumericProperty(12.5) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
|
||
def __init__(self, *args: Any, **kwargs: Any) -> None: | ||
super(TextEditor, self).__init__(*args, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Legacy. |
||
|
||
|
||
class F(FloatLayout): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surely there must be a more intuitive name than this? |
||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should pin your dependencies to a specified version or at least to the next major update. This will prevent undefined behaviour for anyone using your project in future should breaking changes to dependencies be made.