Пример #1
0
class Application(App):
    def build(self):
        Window.clearcolor = (1, 1, 1, 0)
        Window.size = (320, 480)
        self.connection = Connection()
        self.img = Image(source='net.jpeg')
        self.img.allow_stretch = True
        self.img.opacity = 1
        self.password = TextInput(text="Ravikiran@ms1",
                                  multiline=False,
                                  height=10,
                                  size_hint=(None, None))
        self.loginbutton = Button(text="Unlock")
        self.loginbutton.bind(on_press=self.login)
        self.registerbutton = Button(text="Register")
        self.registerbutton.bind(on_press=self.register)
        #creating layout based on conditions
        cols = self.connection.size("pwmanager")
        self.master = BoxLayout(orientation="vertical")
        self.master.add_widget(self.img)
        self.master.add_widget(self.password)
        if cols is not 1:
            self.master.add_widget(self.registerbutton)
        else:
            self.master.add_widget(self.loginbutton)
        return self.master

    def login(self, event):
        passwordtext = self.connection.getvalues("*", "pwmanager")
        userentry = ""
        for i in passwordtext.fetchone():
            userentry = i
        if (userentry == self.password.text):
            self.master.remove_widget(self.loginbutton)
            self.master.remove_widget(self.img)
            self.master.remove_widget(self.password)
            self.connection.conn.close()
        else:
            self.password.text = "Retry"

    def register(self, event):
        if (self.password.text is not ""):
            values = "('{}')".format(str(self.password.text))
            columnname = "('{}')".format("password")
            self.connection.insertintotable("pwmanager", columnname, values)
            self.master.remove_widget(self.registerbutton)
            self.master.add_widget(self.loginbutton)
            self.password.text = ""
Пример #2
0
class Application(App):
    def build(self):
        Window.clearcolor = (1, 1, 1, 0)
        #Window.size=(320,480)
        self.connection = Connection()
        self.img = Image(source='net.jpeg', size_hint=(None, None))
        self.img.allow_stretch = True
        self.img.opacity = 1
        self.password = TextInput(text="password",
                                  multiline=False,
                                  size_hint=(None, None))
        self.loginbutton = Button(text="Unlock", size_hint=(None, None))
        self.loginbutton.bind(on_press=self.login)
        self.registerbutton = Button(text="Register", size_hint=(None, None))
        self.registerbutton.bind(on_press=self.register)
        #creating layout based on conditions
        cols = self.connection.size("pwmanager")
        self.master = FloatLayout()
        if cols is not 1:
            self.master.add_widget(self.registerbutton)
        else:
            self.master.add_widget(self.loginbutton)
        self.master.add_widget(self.img)
        self.master.add_widget(self.password)
        self.master.bind(size=self.on_rotate)
        return self.master

    def login(self, event):
        passwordtext = self.connection.getvalues("*", "pwmanager")
        userentry = ""
        for i in passwordtext.fetchone():
            userentry = i
        if (userentry == self.password.text):
            self.master.remove_widget(self.loginbutton)
            self.master.remove_widget(self.img)
            self.master.remove_widget(self.password)
            self.connection.conn.close()
            self.viewer = Viewer(self.master)
        else:
            self.password.text = "Retry"
        global choice
        choice = 2

    def register(self, event):
        if (self.password.text is not ""):
            values = "('{}')".format(str(self.password.text))
            columnname = "('{}')".format("password")
            self.connection.insertintotable("pwmanager", columnname, values)
            self.master.remove_widget(self.registerbutton)
            self.master.add_widget(self.loginbutton)
            self.password.text = ""

    def on_rotate(self, event, event1):
        global screenheight
        global screenwidth
        global choice
        screenheight = Window.height
        screenwidth = Window.width
        if (choice == 1):
            self.img.pos = (WXY(60), HXY(263))
            self.img.width = WXY(207)
            self.img.height = HXY(164)

            self.password.pos = (WXY(53), HXY(180))
            self.password.width = WXY(208)
            self.password.height = HXY(37)
            self.password.font_size = HXY(18)

            self.loginbutton.pos = (WXY(82), HXY(117))
            self.loginbutton.width = WXY(146)
            self.loginbutton.height = HXY(40)
            self.loginbutton.font_size = HXY(18)

            self.registerbutton.pos = (WXY(82), HXY(117))
            self.registerbutton.width = WXY(146)
            self.registerbutton.height = HXY(40)
        elif (choice == 2):
            self.viewer.on_rotate()
        elif (choice == 3):
            self.viewer.notepad.on_rotate()
Пример #3
0
class Viewer(Screen):
	def __init__(self,**kwargs):
		super (Viewer,self).__init__(**kwargs)
		self.master=FloatLayout()
		Window.clearcolor=(0,1,0,5)
		self.addb=Button(text="ADD",pos=(WXY(2),HXY(450)),width=WXY(60),height=HXY(30),size_hint=(None,None),font_size=HXY(16))
		self.addb.bind(on_press=self.adder)
		self.master.add_widget(self.addb)
		self.layout = GridLayout(cols=1, spacing=HXY(4), size_hint_y=None)
		self.layout.bind(minimum_height=self.layout.setter('height'))
		self.connection=Connection()
		self.values=self.connection.getvalues("date,content","diarydata")
		self.lists=[]
		index=0
		for date,content in self.values:
			self.lists.append(Button(text=content[:int(WXY(20))]+"-----"+str(date), size_hint_y=None, height=30,font_size=18,halign="left", valign="middle"))
			self.lists[index].bind(size=self.lists[index].setter('text_size'))
			self.lists[index].bind(on_press=self.popuptriger)
			self.layout.add_widget(self.lists[index])
			index+=1
		self.connection.conn.close();
		self.root = ScrollView(size=(WXY(310),HXY(440)),pos=(WXY(5),HXY(0)),size_hint=(None,None))
		self.root.add_widget(self.layout)
		self.master.add_widget(self.root)
		self.master.bind(size=self.on_rotate)
		self.add_widget(self.master)

	def on_rotate(self,event,event1):
		global screenheight
		global screenwidth
		global choice
		screenheight=Window.height
		screenwidth=Window.width
		self.addb.pos=(WXY(2),HXY(450))
		self.addb.width=WXY(60)
		self.addb.height=HXY(30)
		self.addb.font_size=HXY(16)

		self.root.size=(WXY(310),HXY(440))
		self.root.pos=(WXY(5),HXY(0))
		self.layout.spacing=HXY(4)
		index=0
	def popuptriger(self,event):
		editButton = Button(text = "Edit")
		deleteButton = Button(text = "Delete")
		cancelButton = Button(text = "Cancel")
		self.identity=event.text
		layout = BoxLayout()
		self.userpriority=Popup(title="Do you wish to continue",content=layout,width=Window.width,height=HXY(100),size_hint=(None,None))
		layout.add_widget(deleteButton)
		layout.add_widget(editButton)
		layout.add_widget(cancelButton)

		editButton.bind(on_press=self.deletelists)
		deleteButton.bind(on_press=self.editviewer)
		cancelButton.bind(on_press=self.userpriority.dismiss)
		
		self.userpriority.open()
	def deletelists(self,event):
		pass
	def editviewer(self,event):
		pass
	def adder(self,event):
		self.master.remove_widget(self.addb)
		self.master.remove_widget(self.root)
		self.manager.current="Logger"