Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

import shutil # Library For Work With File In High Level Like Copy 

import webbrowser 

from params import * 

import socket 

import requests 

import re 

import time 

import sys 

import urllib.request 

import platform 

import random 

 

meta_input = "" 

 

 

def convert_bytes(num): 

""" convert num to idiomatic byte unit 

 

:param num: the input number. 

""" 

for x in ['bytes', 'KB', 'MB', 'GB', 'TB']: 

if num < 1024.0: 

return "%3.1f %s" % (num, x) 

num /= 1024.0 

 

 

def file_size(): 

""" Print the size of output file 

 

""" 

list_of_files = os.listdir(out_dir) 

response = 0 

for file in list_of_files: 

file_info = os.stat(os.path.join(out_dir, file)) 

response += file_info.st_size 

print_line(70, "*") 

print("Used Space --> " + convert_bytes(response)) 

print_line(70, "*") 

 

 

def download_badge(address): 

""" Download badge for website 

 

:param address: the address that should get badge 

""" 

r = requests.get(address, stream=True) 

with open(os.path.join(image_dir, "badge.svg"), 'wb') as f: 

shutil.copyfileobj(r.raw, f) 

 

 

def random_badge_color(): 

"""return a random color for badge 

 

""" 

random_index = random.randint(0, len(badge_color_list) - 1) 

return badge_color_list[random_index] 

 

 

def system_details(): 

""" Show detail of system that code is runnig on 

 

""" 

return platform.node() + " , " + platform.processor() + " , " + platform.platform() 

 

 

def generation_time(time_1=None): 

""" Calculate the generation time 

 

:param time_1: time that passed but not counted in generation time 

:return :the amount of time that passed . 

""" 

if time_1 is None: 

return time.perf_counter() 

else: 

return time.perf_counter() - time_1 

 

 

def find_global_ip(): 

""" Find the ip for use in API 

 

:return: return the IP. 

""" 

try: 

response = requests.get(ip_finder_api) 

return response.text[:-1] 

except: 

return "0.0.0.0" 

 

 

def create_badge(subject="qpage", status=version, color="blue", random=False): 

if random: 

color = random_badge_color() 

else: 

if color not in badge_color_list: 

color = "orange" 

badge_adr = adv_badge_static + subject + "-" + status + "-" + color + '.svg' 

if internet(): 

download_badge(badge_adr) 

return os.path.join(image_dir, "badge.svg") 

else: 

return badge_adr 

 

 

def is_sample_downloaded(): 

""" Check the sample site material is downloaded 

 

:return : list of the materials 

""" 

download_list = [] 

if "profile.png" not in os.listdir(image_dir): 

download_list.append(0) 

if "font.TTF" not in os.listdir(font_dir): 

download_list.append(1) 

if "resume.pdf" not in os.listdir(doc_dir) and "resume.txt" not in os.listdir(doc_dir): 

download_list.extend([2, 3]) 

if "icon.ico" not in os.listdir(image_dir): 

download_list.append(4) 

return download_list 

 

 

def download_lorem(): 

""" Download the lorem file 

 

""" 

if internet(): 

urllib.request.urlretrieve("http://www.qpage.ir/sample/Latin-Lipsum.txt", "Latin-Lipsum.txt") 

else: 

print("Error In Download Lorem") 

 

 

def read_lorem(char=100): 

""" find and read lorem 

 

:param char: the amount of char that needed 

:return : the lorme string 

""" 

try: 

if "Latin-Lipsum.txt" not in os.listdir(work_dir): 

download_lorem() 

lorem_file = open("Latin-Lipsum.txt", "r") 

lorem_text = lorem_file.read() 

lorem_file.close() 

return " ".join(lorem_text.split(" ")[:char]) 

except: 

return None 

 

 

def sample_site_download(item_list): 

"""Download sample material for make a fake site 

 

:param item_list: Download items form item_list 

""" 

try: 

if internet(): 

for i in item_list: 

print("Downloading " + sample_dict_message[i] + " . . . [" + str(i + 1) + "/5]") 

print_line(70) 

urllib.request.urlretrieve(list(sample_dict_addr.values())[i], 

os.path.join(image_dir, list(sample_dict_addr.keys())[i])) 

print("Done! All Material Downloaded") 

print_line(70) 

else: 

print("Error In Internet Connection!") 

print_line(70) 

except: 

print("Error in downloading sample files check your internet conection") 

print_line(70) 

 

 

def logger(status=False, perf_time=None): 

"""Show the log of the app 

 

:param status: show status of app. 

:param perf_time : show the time passed for generate files 

""" 

file = open("build_log.txt", "a") 

if not status: 

file.write("Failed " + str(datetime.datetime.now()) + "\n") 

else: 

file.write("Success " + str(datetime.datetime.now()) + "\n") 

file.write("Generation Time: " + str(perf_time) + "\n") 

file.close() 

 

 

def print_line(number, char="-"): 

""" Print a Line 

 

:param number: the amount char that in lien 

:param char : the char that used to draw line 

""" 

line = "" 

for i in range(number): 

line += char 

print(line) 

 

 

def name_standard(name): 

""" return the Standard version of the input word 

 

:param name: the name that should be standard 

:return name: the standard form of word 

""" 

reponse_name = name[0].upper() + name[1:].lower() 

return reponse_name 

 

 

def address_print(): 

"""Print the working directory 

 

""" 

print_line(70, "*") 

print("Where --> " + work_dir) 

print_line(70, "*") 

 

 

def create_folder(): 

"""This Function Create Empty Folder At Begin 

 

""" 

folder_flag = 0 

list_of_folders = os.listdir(work_dir) 

for i in ["doc", "image", "output", "font"]: 

if i not in list_of_folders: 

os.mkdir(i) 

folder_flag += 1 

if i == "doc": 

file = open(os.path.join(doc_dir, "index.txt"), "w") 

if read_lorem() is None: 

file.write("This is For First Page . . .") 

else: 

file.write(read_lorem()) 

file.close() 

return bool(folder_flag) 

 

 

def page_name_update(): 

"""This Function Update Page Names 

 

""" 

for i in os.listdir(doc_dir): 

if i.find(".txt") != -1 and i[:-4].upper() != "INDEX": 

actual_name.append(i[:-4]) 

page_name.append(i[:-4]) 

 

 

def menu_maker(): 

"""Top Menu Maker In each html page 

 

""" 

result = "<center>" 

for i,item in enumerate(page_name): 

if item == "Home": 

targets_blank = "" 

else: 

targets_blank = 'target="blank"' 

# Hyper Link To Each Page In HTML File 

result += '\t<a href="' \ 

+ actual_name[i] + '.html"' + targets_blank + '>' + name_standard(item) + "</a>\n" 

result += "&nbsp\n" 

result += "</center>" 

result = result + "\t\t" + break_line # Add Break line to End Of The Menu 

return result # Return All Of The Menu 

 

 

def menu_writer(): # 

"""Write menu_maker output in html and close file after 

 

""" 

message = menu_maker() 

for i,item in enumerate(page_name): 

file = open(os.path.join(out_dir, actual_name[i] + ".html"), "a") 

file.write(message) 

file.close() 

 

 

def print_meta(): 

"""Add meta to html files 

 

:return static_meta: The meta that created 

""" 

global meta_input 

meta_input = input("Please Enter Your Name : ") 

static_meta = '<meta name="description" content="Welcome to homepage of ' + meta_input + '"/>\n' 

static_meta += '<meta property="og:title" content="' + meta_input + '"/>\n' 

static_meta += '<meta property="og:site_name" content="' + meta_input + '"/>\n' 

static_meta += '<meta property="og:image" content="favicon.ico" />\n' 

if len(meta_input) < 4: 

warnings.append("[Warning] Your input for name is too short!!") 

return static_meta 

 

 

def html_init(name): 

"""Create Initial Form Of each Html Page Like Title And HTML And Body Tag. 

 

:param name: the name of html file. 

""" 

 

html_name = os.path.join(out_dir, name + ".html") 

file = open(html_name, "w") 

file.write("<html>\n") 

file.write("\t<head>\n") 

if name == "index": 

file.write("\t\t<title>Welcome To My Homepage</title>\n") 

else: 

file.write("\t\t<title>" + name_standard(name) + "</title>\n") 

file.write('<link rel="stylesheet" href="styles.css" type="text/css"/>\n') 

css_link = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' 

file.write('<link rel="stylesheet" href= ' + css_link + ' type="text/style"/>\n') 

 

if name == 'index': # Add meta only for index page 

file.write(print_meta()) 

 

file.write("\t</head>\n") 

file.write('\t<body class="body_tag">\n') 

file.close() 

 

 

def html_end(name): 

"""Create End Of The Html and close file 

 

:param name: The name of html file. 

""" 

html_name = os.path.join(out_dir, name + ".html") 

file = open(html_name, "a") 

file.write("\t</body>\n") 

file.write("</html>") 

file.close() 

 

 

def close_files(): 

"""Close all the files. 

 

""" 

for i in files: 

if i.closed==False: 

i.close() 

 

 

def LSM_translate(line, center): 

# TODO : write a document for this function 

""" ???? 

 

:param line: the input line. 

:param center: put it in center 

 

:return : return a list contain text header end and header begin 

""" 

line.strip() 

text = line 

header_start = '<h4 class="color_tag">' 

header_end = "</h4>" 

if line.find("[L]") != -1: 

header_start = '<h2 class="color_tag">' 

header_end = "</h2>" 

text = line[3:] 

elif line.find("[S]") != -1: 

header_start = '<h5 class="color_tag">' 

header_end = "</h5>" 

text = line[3:] 

elif line.find("[M]") != -1: 

text = line[3:] 

if center: # Centuries Text If Condition Is True For Manual Centering 

header_start = "<center>" + header_start 

header_end += "</center>" 

if text.find("[center]") != -1: # Find Center Tag In Each Line 

header_start = "<center>" + header_start 

header_end += "</center>" 

text = text[:text.find("[center]")] 

return [text, header_end, header_start] 

 

 

def print_text(text_file, file, center=False, close=False): # Write Text Part Of Each Page 

"""Write the text part of each page 

 

:param text_file: Text tha should be written. 

:param file : The file that text will be written inside. 

:param center : put the text in center. 

:param close : close file after done editing 

 

:type close : bool 

:type center: bool 

 

""" 

 

text_code = "" 

for line in text_file: 

if len(line) == 1: 

text_code = space 

else: 

text_header = LSM_translate(line, center) 

text = text_header[0] 

header_end = text_header[1] 

header_start = text_header[2] 

text_code = header_start + text + header_end + "\n" 

file.write(text_code) 

if close: 

file.close() 

 

 

def print_image(file, image_format="jpg", close=False): 

"""Write Image Part OF The Page. 

 

:param file: The file that images will be added. 

:param close : close file after done editing. 

:param image_format: the format of image 

 

:type close : bool 

""" 

for i,item in enumerate(size_box): 

print(i, "-", item) 

image_size = int(input("Please Enter Profile Image Size : ")) # Choose Profile Image Size 

image_size_string = size_box[2] # Getting Html String From size_box list default mode (Medium) 

if 0 <= image_size < len(size_box): 

image_size_string = size_box[image_size] 

image_code = '<center><img src="image.' + image_format + '"' + ', width=' + image_size_string + ' alt="profile image"></img></center>\n' 

file.write(image_code) 

if close: 

file.close() 

 

 

def print_download(file, name, link, center=False, close=False): 

""" Create Download Link in page 

 

:param file: The file that contain html of page. 

:param name: The name of the link 

:param link: The place that name is Linked 

:param center: put the text in center 

:param close : close file after done editing 

 

:type center: bool 

:type close : bool 

 

""" 

link_code = "<a href=" + '"' + link + '"' + target_blank + '>' + name + "</a>" 

if center: 

link_code = "<center>" + link_code + "</center>" 

file.write(link_code + "\n") 

file.write(break_line) 

if close: 

file.close() 

 

 

def print_adv(file, close=True): 

""" Print the advertisement. 

 

:param file : The file that should ad to it. 

:param close : Close file after add ad 

""" 

file.write(break_line) 

file.write( 

'<center>' + "<p>" + "Generated " + today_time + " By" + "</p>" + '<a href=' + '"' + homepage + '"' + target_blank + '>' + '<img src="' + create_badge( 

random=True) + '"alt="Qpage">' + '</a> </center>') 

if close: 

file.close() 

 

 

def build_index(file): 

""" Find and build index page 

 

:param file: The index file. 

""" 

image_name = "" 

img_format = "jpg" 

file_of_images = os.listdir(image_dir) 

for i in file_of_images: 

for form in imformat_box: 

if i.find("." + form) != -1: 

image_name = os.path.join(image_dir, i) 

img_format = form 

global image_counter 

image_counter = 1 

break 

shutil.copyfile(image_name, os.path.join(out_dir, "image." + img_format)) 

print_image(file, img_format) 

 

 

def build_resume(file): 

""" Find and build resume page. 

 

:param file: The resume file. 

""" 

resume_name = "" 

file_of_docs = os.listdir(doc_dir) 

for i in file_of_docs: 

if i.find(".pdf") != -1: 

resume_name = os.path.join(doc_dir, i) 

global pdf_counter 

pdf_counter = 1 

break 

shutil.copyfile(resume_name, os.path.join(out_dir, "Resume.pdf")) 

print_download(file, "Download Full Version", "Resume.pdf", center=True) 

 

 

def contain(name): 

"""main function That Open Each Page HTML File and call other function to write data in it 

 

:param name: the name of the file that should be written 

""" 

# 

file = open(os.path.join(out_dir, name + ".html"), "a") 

text_file = open(os.path.join(doc_dir, name + ".txt"), "r") 

files.append(file) 

files.append(text_file) 

 

if name.upper() == "INDEX": 

build_index(file) 

elif name.upper() == "RESUME": 

build_resume(file) 

 

print_text(text_file, file) 

if name.upper() == "INDEX": 

print_adv(file) 

 

 

def clear_folder(path): 

"""This Function Get Path Of Foldr And Delete Its Contains 

 

:param path: the path that gonna be deleted. 

""" 

 

if os.path.exists(path): 

list_of_files = os.listdir(path) 

for file in list_of_files: 

os.remove(os.path.join(path, file)) 

else: 

os.mkdir(path) 

 

 

def print_warning(): 

""" Print Warinigns! 

 

""" 

print(str(len(warnings)) + " Warning , 0 Error") 

for i,item in enumerate(warnings): 

print(str(i + 1) + "-" + item) 

 

 

def get_color_code(): 

"""Ask for selecting color of text and background 

 

:return list: background and text color 

""" 

for i,item in enumerate(color_box): 

print(i, "-", item) 

back_color_code = int(input("Please enter your background color : ")) 

if back_color_code not in range(7): 

back_color_code = 0 

text_color_code = int(input("Please enter your text color : ")) 

if text_color_code not in range(7): 

text_color_code = 1 

return [back_color_code, text_color_code] 

 

 

def color_code_map(): 

""" Check and insert colors that is chosen. 

 

:return list: background and text color 

""" 

[back_color_code, text_color_code] = get_color_code() 

if text_color_code == back_color_code: 

warnings.append(warning_dict["color_warning"] + " Your text color and background color are same!!") 

background_color = color_box[back_color_code] # convert code to color string in color_box 

text_color = color_box[text_color_code] # convert code to color string in color_box 

return [background_color, text_color] 

 

 

def css_font(font_folder): 

""" Search and file all fonts. 

 

:param font_folder: the folder to search. 

:return list : font_flag and the current format 

""" 

font_flag = 0 # 0 If there is no font file in font_folder 

current_font_format = None 

for i in font_folder: 

for j in font_format: # search for other font format in font box 

if i.lower().find(j) != -1: # If there is a font in font folder 

shutil.copyfile(os.path.join(font_dir, i), 

os.path.join(out_dir, "qpage" + j)) # copy font file to output folder 

font_flag = 1 # Turn Flag On 

current_font_format = j # font format of current selected font for css editing 

return [font_flag, current_font_format] 

 

 

def font_creator(css_file, font_section): 

""" Ask and Select font. 

 

:param css_file: the file that font css will be added to. 

:param font_section: the font section of css file 

 

:return font_section: the font section of css after edit 

""" 

font_folder = os.listdir(font_dir) 

details = css_font(font_folder) 

current_font_format = details[1] 

font_flag = details[0] 

 

if font_flag == 1: # check flag if it is 1 

css_file.write( 

"@font-face{\nfont-family:qpagefont;\nsrc:url(qpage" 

+ current_font_format 

+ ");\n}\n") # Write font-face in html 

 

font_section = "font-family:qpagefont;\n" # Update Font Section For Body Tag 

for i,item in enumerate(fontstyle_box): 

print(i, "-", item) 

font_style = int(input(" Please choose your font style ")) 

if font_style < len(fontstyle_box): 

font_style = fontstyle_box[font_style] 

else: 

font_style = "normal" 

font_section = font_section + "font-style:" + font_style + ";\n" 

else: 

warnings.append(warning_dict["font_warning"] + " There is no specific font set for this website!!") 

return font_section 

 

 

def css_creator(): 

"""Ask For background and text color in and make css """ 

font_section = 'font-family : Georgia , serif;\n' 

colors = color_code_map() 

background_color = colors[0] 

text_color = colors[1] 

 

css_file = open(os.path.join(out_dir, "styles.css"), "w") # open css file 

font_section = font_creator(css_file, font_section) 

 

css_file.write( 

".body_tag{\n" 

+ "background-color:" 

+ background_color 

+ ";\n" 

+ font_section 

+ css_margin 

+ css_animation_1 

+ "}\n") # write body tag 

 

css_file.write(".color_tag{\n" + "color:" + text_color + ";\n}") # write color_tag in css 

css_file.write(css_animation_2) 

css_file.close() # close css file 

 

 

def preview(): 

"""Preview website in browser """ 

# TODO: not working on unix 

 

webbrowser.open(os.path.join(out_dir, "index.html")) 

 

 

def error_finder(): 

""" Check and find error that display it""" 

error_vector = [] 

pass_vector = [] 

pdf_counter = 0 

#image_list = os.listdir(image_dir) 

doc_list = os.listdir(doc_dir) 

if image_counter == 1: 

pass_vector.append("[Pass] Your profile image in OK!!") 

else: 

error_vector.append(error_dict["image_error"] + " Your profile image is not in correct format") 

if len(doc_list) == 0: 

error_vector.append(error_dict["empty_error"] + "There is no file in doc folder ( index.txt and .pdf file in " 

"necessary)") 

else: 

if "index.txt" in doc_list: 

pass_vector.append("[Pass] index.txt file OK!") 

else: 

error_vector.append(error_dict["firstpage_error"] + " index.txt is not in doc folder!") 

if pdf_counter == 0: 

error_vector.append(error_dict["resume_error"] + "[Error] Where Is Your Resume File? It should be in doc " 

"folder") 

else: 

pass_vector.append("[Pass] Your Resume File is OK!!") 

return [error_vector, pass_vector] 

 

 

def icon_creator(): 

""" Find .ico file and use it as favicon of website.""" 

icon_flag = 0 

for file in os.listdir(image_dir): 

if file.endswith('ico'): 

shutil.copy(os.path.join(image_dir, file), out_dir) 

os.rename(os.path.join(out_dir, file), os.path.join(out_dir, 'favicon.ico')) 

icon_flag = 1 

break 

if "favicon.ico" in os.listdir(work_dir) and icon_flag == 0: 

shutil.copy(os.path.join(work_dir, "favicon.ico"), out_dir) 

warnings.append(warning_dict["icon_warning"] + " There is no icon for this website") 

 

 

def robot_maker(): 

""" Create Robots.txt for pages """ 

robots = open(os.path.join(out_dir, "robots.txt"), "w") 

robots.write("User-agent: *\n") 

robots.write("Disallow: ") 

robots.close() 

 

 

def internet(host="8.8.8.8", port=53, timeout=3): 

""" Check Internet Connections. 

 

:param host: the host that check connection to 

:param port: port that check connection with 

:param timeout: times that check the connnection 

 

:return bool: True if Connection is Stable 

""" 

try: 

socket.setdefaulttimeout(timeout) 

socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port)) 

return True 

except Exception as ex: 

print(ex) 

return False 

 

 

def server(): 

"""Get Server response.""" 

#global meta_input 

headers = {'content-type': 'application/json', "NAME": meta_input, "Version": version, "SYSTEM": system_details(), 

"IP": find_global_ip()} 

response = requests.get(server_api, headers=headers) 

if response.status_code==200: 

print("Installed Saved!") 

 

 

def version_control(): 

""" Check and update Versions. """ 

 

try: 

# print("Check for new version . . .") 

# print_line(70) 

version_pattern = r"last_version:(.+)" 

if internet(): 

response = requests.get("http://www.qpage.ir/releases.html") 

body = response.text 

last_version = float(re.findall(version_pattern, body)[0][:-3]) 

if last_version > float(version): 

print_line(70) 

print("**New Version Of Qpage Is Available Now (Version " + str(last_version) + ")**") 

print("Download Link -->" + "https://github.com/sepandhaghighi/qpage/archive/v" + str( 

last_version) + ".zip") 

print_line(70) 

else: 

# TODO : fix version control else 

pass 

# print("Already Updated!!!") 

# print_line(70) 

except: 

pass 

 

 

def enter_to_exit(): 

"""Quit Project by pressing a key. 

 

""" 

 

print_line(70, "*") 

response = input("Enter [R] for restart Qpage and any other key to exit : ") 

if response.upper() != "R": 

sys.exit() 

 

 

def wait_func(iteration): 

"""Wait for-in range Iteration. 

 

:param iteration: the amount of wait. 

""" 

 

for _ in range(iteration): 

time.sleep(1) 

print(".")