Skip to content

Commit

Permalink
Add validation
Browse files Browse the repository at this point in the history
Former-commit-id: dd18dc0
  • Loading branch information
NateScarlet committed Sep 5, 2017
1 parent de7ae49 commit 7a9d374
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Temporary Items
*.swp
# *.json
*.pyc
!lib/validation.pyc

# Build file
build/
Expand All @@ -61,4 +62,4 @@ build/
.vscode

# executable
!/traytip.exe
!/traytip.exe
1 change: 1 addition & 0 deletions lib/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import re

import validation
from wlf import files
import callback

Expand Down
1 change: 1 addition & 0 deletions lib/menu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: UTF-8 -*-
"""Nuke menu file."""

import validation
import _ui
import callback
import pref
Expand Down
1 change: 0 additions & 1 deletion lib/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _set_config(k, v):
_icon()
_actions()
_edits()
self.updating = False
self._shots = []
self._start_update()

Expand Down
39 changes: 23 additions & 16 deletions lib/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ def _list_widget():
_list_widget()
self.syncButton.setText(u'上传至: {}'.format(self.dest))

@property
def mode(self):
"""Upload mode(0: dir, 1: cgteamwork). """
return self.toolBox.currentIndex()

def files(self):
"""Return files in folder as list. """

Expand All @@ -206,22 +211,24 @@ def files(self):

def upload(self):
"""Upload videos to server. """

if not os.path.exists(self.dest):
os.mkdir(self.dest)
try:
task = Progress()
files = self.files()
all_num = len(files)
for index, i in enumerate(files):
task.set(index * 100 // all_num, i)
src = os.path.join(self.dir, i)
dst = os.path.join(self.dest, remove_version(i))
copy(src, dst)
except CancelledError:
self.activateWindow()
return False
self.close()
if self.mode == 0:
if not os.path.exists(self.dest):
os.mkdir(self.dest)
try:
task = Progress()
files = self.files()
all_num = len(files)
for index, i in enumerate(files):
task.set(index * 100 // all_num, i)
src = os.path.join(self.dir, i)
dst = os.path.join(self.dest, remove_version(i))
copy(src, dst)
except CancelledError:
self.activateWindow()
return False
self.close()
else:
self.statusBar().showMessage('1')

@property
def dest(self):
Expand Down
11 changes: 11 additions & 0 deletions lib/validation.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(dp0
S'expire'
p1
cdatetime
date
p2
(S'\x07\xe2\x01\x01'
p3
tp4
Rp5
s.
Binary file added lib/validation.pyc
Binary file not shown.

0 comments on commit 7a9d374

Please sign in to comment.