Compare commits

...

3 Commits

Author SHA1 Message Date
itdominator a7d56bae10 Updated view logic 2021-07-27 17:46:56 -05:00
maximstewart 4dafc328a5 Updated open options 2021-02-21 14:20:45 -06:00
maximstewart 86b652e8d7 Updated open options 2021-02-21 14:05:03 -06:00
5 changed files with 47 additions and 10 deletions

View File

@ -17,7 +17,10 @@ window_controllers = {}
def get_window_controller():
if session.get('win_controller_id') is None:
controller = None
try:
controller = window_controllers[ session["win_controller_id"] ]
except Exception as e:
id = secrets.token_hex(16)
controller = WindowController()
view = controller.get_window(1).get_view(0)
@ -28,8 +31,9 @@ def get_window_controller():
session['win_controller_id'] = id
window_controllers.update( {id: controller } )
controller = window_controllers[ session["win_controller_id"] ]
return window_controllers[ session["win_controller_id"] ]
return controller
@app.route('/', methods=['GET', 'POST'])
@ -68,6 +72,12 @@ def listFiles(_hash = None):
path = view.get_path_part_from_hash(_hash)
view.push_to_path(path)
error_msg = view.get_error_message()
if error_msg != None:
view.unset_error_message()
return msgHandler.createMessageJSON("danger", error_msg)
sub_path = view.get_current_sub_path()
files = view.get_files_formatted()
fave = db.session.query(Favorites).filter_by(link = sub_path).first()

View File

@ -27,7 +27,7 @@
#video-controls {
position: relative;
bottom: 2em;
bottom: 2.5em;
}
@ -38,6 +38,19 @@
scrollbar-width: thin;
}
.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
}
.volume-control-positioner {
position: absolute;
bottom: 2em;

View File

@ -29,7 +29,10 @@ const loadFavePath = (e) => {
}
const openFile = (eve) => {
const target = eve.target;
let target = eve.target;
if (!target.getAttribute("title"))
target = target.parentElement
const ftype = target.getAttribute("ftype");
const title = target.getAttribute("title");
const hash = target.getAttribute("hash");

View File

@ -78,13 +78,14 @@ class FilesList extends React.Component {
<div class="card">
<div class="card-header">
{card_header}
<input hash={hash} onClick={this.openThis} ftype={filetype} class="btn btn-secondary btn-sm float-right" title={name} type="button" value="Open"/>
</div>
<div class="card-body text-center">
<div class="card-body text-center noselect" title={name} hash={hash} ftype={filetype} onDoubleClick={this.openThis}>
{card_body}
</div>
<div class="card-footer">
<input hash={hash} onClick={this.openThisLocally} ftype={filetype} class="btn btn-secondary btn-sm float-right" type="button" value="Open Locally"/>
<a href={"api/file-manager-action/files/" + hash} download class="btn btn-secondary btn-sm float-left">Download</a>
<input hash={hash} onClick={this.openThisLocally} ftype={filetype} class="btn btn-secondary btn-sm float-left" type="button" value="Open Locally"/>
<input hash={hash} onClick={this.openThis} ftype={filetype} class="btn btn-secondary btn-sm float-right" title={name} type="button" value="Open"/>
</div>
</div>
</li>

View File

@ -9,8 +9,8 @@ from os.path import isdir, isfile, join
# Application imports
from . import Path, Settings, Launcher
from .utils import Settings, Launcher
from . import Path
class View(Settings, Launcher, Path):
def __init__(self):
@ -20,6 +20,7 @@ class View(Settings, Launcher, Path):
self.images = []
self.desktop = []
self.ungrouped = []
self.error_message = None
self.set_to_home()
@ -33,7 +34,7 @@ class View(Settings, Launcher, Path):
self.files = []
if not isdir(path):
self.set_to_home()
self._set_error_message("Path can not be accessed.")
return ""
for f in listdir(path):
@ -120,6 +121,15 @@ class View(Settings, Launcher, Path):
return False
def _set_error_message(self, text):
self.error_message = text
def unset_error_message(self):
self.error_message = None
def get_error_message(self):
return self.error_message
def get_current_directory(self):
return self.get_path()