Kaydet (Commit) a70226fb authored tarafından Ali Rıza Keskin's avatar Ali Rıza Keskin

İndirme çubuğu terminal ekranına uyum sağlayacak hale getirildi.

üst ad41bb1f
......@@ -2,6 +2,7 @@ PREFIX=/
all: build install
clean:
`find | grep pycache | sed 's/^/rm -rf /g'`
rm -rf build
build:
python3 setup.py build
......
......@@ -178,13 +178,13 @@ class CLI(inary.ui.UI):
elif ka['operation'] == "fetching":
totalsize = '%.1f %s' % util.human_readable_size(ka['total_size'])
out = '%-30.50s(%s)%3d%% %9.2f %s[%s]' % \
(ka['filename'], totalsize, ka['percent'],
ka['rate'], ka['symbol'], ka['eta'])
self.output('\r\033[2K'+util.colorize_percent(out,ka['percent']))
out = '%-30.50s(%s)' % (ka['filename'], totalsize)
out2= '%3d%% %9.2f%s [%s]' % (ka['percent'], ka['rate'],ka['symbol'], ka['eta'])
self.output('\r\033[2K'+util.colorize_percent(out,ka['percent'],out2))
util.xterm_title("%s (%d%%)" % (ka['filename'], ka['percent']))
else:
self.output("\r\033[2K"+colorize_percent("%s (%d%%)" % (ka['info'], ka['percent']),ka['percent']))
self.output("\r\033[2K"+colorize_percent(("%s" % ka['info']),ka['percent'],("(%d%%)" % ka['percent'])))
util.xterm_title("%s (%d%%)" % (ka['info'], ka['percent']))
def status(self, msg=None, push_screen=True):
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019, Sulin Community
#
# 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.
#
# Please read the COPYING file.
#
import inary.errors
class Error(inary.errors.Error):
pass
class Exception(inary.errors.Exception):
pass
# -*- coding:utf-8 -*-
#
import time
letter='abcdefghijklmnopqrstuvwyzABCDEFGHIJKLMNOPQRSTUWYZ'
len_letter=len(letter)
def nextString(length=0):
source=str(int(time.time()*10000000))
if length > len(source) or length <= 0:
length = len(source)
sr=""
while length > 1:
sr=sr+letter[int(source[len(source)-length]+source[len(source)-length+1])%len(letter)]
length=length-1
return sr
# -*- coding:utf-8 -*-
#Merge sort by sulincix
def msort(x):
def sort_bubble(array=[]):
mlen=len(array)
cout_i=0
while cout_i<mlen:
cout_j=0
while cout_j<mlen-1:
if array[cout_j-1] > array[cout_j]:
tmp=array[cout_j-1]
array[cout_j-1]=array[cout_j]
array[cout_j]=tmp
cout_j=cout_j+1
cout_i=cout_i+1
return array
def sort_merge(x):
result = []
if len(x) < 2:
return x
mid = int(len(x)/2)
y = msort(x[:mid])
z = msort(x[mid:])
y = sort_merge(x[:mid])
z = sort_merge(x[mid:])
while (len(y) > 0) or (len(z) > 0):
if len(y) > 0 and len(z) > 0:
if y[0] > z[0]:
......
......@@ -1048,7 +1048,12 @@ def colorize(msg, color):
else:
return str(msg)
def colorize_percent(msg,percent,color='backgroundgreen',color2='backgroundyellow',color3='brightblue'):
def colorize_percent(message,percent=0,message2=' ',color='backgroundgreen',color2='backgroundyellow',color3='brightblue'):
term_rows, term_columns = get_terminal_size()
spacenum=(term_columns-(len(message)+len(message2)))
if spacenum < 1:
spacenum=0
msg=message+spacenum*' '+message2
if len(msg)<1:
return str(msg)
lmsg=int((len(msg)*percent)/100)+1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment