Beispiel #1
0
	def __init__(self, mainwindow, model):
		super(PyJizz, self).__init__()
		self.mainwindow = mainwindow
		self.model = model
		self.parser = PyJizzParser(self.model)
		self.tableModel = PageModel(self.model)
		self.mainwindow.ui.tableView.setModel(self.tableModel)
		self.currentCategory = None
		#self.player = QMediaPlayer()
		#self.player.setVideoOutput(self.mainwindow.player)
		#self.player.setMedia(QMediaContent(QUrl("http://cdn2b.video.pornhub.phncdn.com/videos/201508/19/55394221/vl_720P_1591.0k_55394221.mp4?rs=200&ri=2900&ipa=2.94.184.41&s=1448912461&e=1448919661&h=db084a1408809a2b48c814156f2c30a6")))
		#self.player.setVolume(100)
		
		self.connections()
		
		self.showCategories()
		
		self.block(False)
Beispiel #2
0
class PyJizz(QObject):
	def __init__(self, mainwindow, model):
		super(PyJizz, self).__init__()
		self.mainwindow = mainwindow
		self.model = model
		self.parser = PyJizzParser(self.model)
		self.tableModel = PageModel(self.model)
		self.mainwindow.ui.tableView.setModel(self.tableModel)
		self.currentCategory = None
		#self.player = QMediaPlayer()
		#self.player.setVideoOutput(self.mainwindow.player)
		#self.player.setMedia(QMediaContent(QUrl("http://cdn2b.video.pornhub.phncdn.com/videos/201508/19/55394221/vl_720P_1591.0k_55394221.mp4?rs=200&ri=2900&ipa=2.94.184.41&s=1448912461&e=1448919661&h=db084a1408809a2b48c814156f2c30a6")))
		#self.player.setVolume(100)
		
		self.connections()
		
		self.showCategories()
		
		self.block(False)

	def connections(self):
		self.mainwindow.categoryClicked.connect(self.onCategoryClicked)
		self.mainwindow.page.connect(self.onPageChanged)
		
	def block(self, blocked):
		self.mainwindow.setEnabled(not blocked)

	def showCategories(self):
		#if not os.path.isdir(self.model.categories_image_path):
		self.parser.parseCategories()
		id = 0
		for x in self.model.p**n:
			path = '{ip}/{i}.jpg'.format(ip = self.model.categories_image_path, i = id)
			name = x['category']
			self.mainwindow.addCategory(id, name, path)
			id += 1
		#self.mainwindow.addCategory(0,"0", self.model.categories_image_path + "/0.jpg")
		#self.mainwindow.addCategory(1,"1", self.model.categories_image_path + "/1.jpg")
		#self.mainwindow.addCategory(2,"2", self.model.categories_image_path + "/2.jpg")
		#self.mainwindow.addCategory(3,"3", self.model.categories_image_path + "/3.jpg")
	
	def pageHandler(self, page):
		print(page)
		if page == 1:
			self.mainwindow.ui.pagePrevButton.setEnabled(False)
		elif not self.mainwindow.ui.pagePrevButton.isEnabled():
			self.mainwindow.ui.pagePrevButton.setEnabled(True)
			
		#last_index = self.tableModel.rowCount()
		#print("last ", last_index)
		#self.tableModel.beginInsertRows(QModelIndex(),last_index,3)
		self.tableModel.beginResetModel()
		
		if self.currentCategory != None:
			self.parser.parseCategoryPage(self.currentCategory, page)
			
		self.tableModel.upd()
		#self.tableModel.endInsertRows()
		self.tableModel.endResetModel()
		
		self.mainwindow.ui.tableView.resizeColumnsToContents() 
	
	@pyqtSlot(int)
	def onCategoryClicked(self, _id):
		print("cat ", _id)
		#self.parser.parseCategoryPage(_id)
		self.currentCategory  = _id
		self.tableModel.setCategory(_id)
		self.mainwindow.resetPages()
		
	@pyqtSlot(int)
	def onPageChanged(self, page):
		print("page changed")
		self.block(True)
		self.pageHandler(page)
		self.block(False)
Beispiel #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: Serge Watchou
"""
import platform

from view import RootView, ProviderFrame
from model import PageModel, Page
from controller import PageController

if platform.system() != 'Windows':
    from hardware import Hardware

if __name__ == "__main__":
    m = PageModel()
    v = RootView()
    p = ProviderFrame(v)
    if platform.system() != 'Windows':
        h = Hardware()

    c = PageController(m, v, p)
    c.getView().mainloop()