Pyqt basic learning practice 2 initial interface based on oschina Note Software

Source: Internet
Author: User
Main Interface of the Note Software

I want to create a cross-platform Notes software based on oschina (share it with you if you do well, and collect your own notes if you do not do well ...., Oschina openapi is familiar, but QT is not very familiar, because it is still learning ...), Next, I often encounter the following problems when using other note-taking software:

  1. Not cross-platform, because many pseudo-Programmers like me will switch between Windows and Linux or Mac, and OneNote can only run on windows, and the Linux client with Evernote is not ideal. HoweverNoteIt is indeed a good choice.
  2. As a note-taking software, I think it should have something likeDesktop notes,Calendar reminderAnd some other user-friendly functions.NoteWindows client can obtain this requirement
  3. Secondly, we also have many notes to share with you. Although these note-taking software has the sharing function, it is useless to the average person, because he does not have a recognized platform. If it is based on oschina, we can share it with a public blog. In addition, oschina can also set up a private blog, which can be well protected for some private notes.
  4. So I think this idea is still feasible.
  5. Because the focus is on the notes, this topic will certainly ignore the news, consultations, and moves on some oschina in the early stage. In the later stage, we should take a look at the specific situation and add it slowly.

The basic functions of the target are as follows:

  • Cross-platform
  • Has a blog (public), a diary (private), and a daily task plan (as a note)
  • Have your own editor (no editor can be used, and then write something. Second, the interface style is better and unified) (it is best to have the preview function)
  • This function is similar to the alarm function.
  • The interface should be as beautiful as possible, and several different styles can be set
Difficulties
  1. Blog writing requires an Editor (intended to implement markdown editing first). I have heard of using webview blabla as an editor, but I am not very clear about it and have no experience at all ,. Some open-source markdown editors based on QT have not been able to look at them yet, so this is a difficult and key point at this stage. It would be better if any great god could help (I am at a low level.
Plan
  1. I want to first create a code interface and then organize and optimize the code.
  2. Then we will conduct some technical research (such as the editor)
  3. Then associate the interface with the backend
  4. It's about to start school... Something is hard to say...
Code
#-*-Coding: utf8-*-from pyqt4 import qtcore, qtguifrom pyqt4.qtcore import * From pyqt4.qtgui import * import mainqssclass mainui (qwidget): def _ init _ (self, parent = none): qwidget. _ init _ (self, parent) # self. shadow = qgraphicsdropshadoweffect (Self) # self. shadow. setblurradius (15) # self. shadow. setcolor (qcolor ("blue") # self. shadow. setoffset (20, 20) # self. setgraphicseffect (self. shadow) self. setwindowflags (QT. framelesswindowhint) self. layout = qhboxlayout (Self) self. leftwidget = qwidget () self. centerwidget = qwidget () self. rightwidget = qwidget () self. leftwidget. setmaximumwidth (300) self. leftwidget. setminimumwidth (200) self. leftwidget. setsizepolicy (qsizepolicy. minimum, qsizepolicy. minimum) # growflag self. centerwidget. setsizepolicy (qsizepolicy. expanding, qsizepolicy. expanding) # growflag self. rightwidget. setsizepolicy (qsizepolicy. preferred, qsizepolicy. expanding) # growflag self. centerwidget. setminimumwidth (550) self. rightwidget. setminimumwidth (250) self. rightwidget. setmaximumwidth (300) self. leftwidget. setstylesheet (mainqss. threewidget) self. centerwidget. setstylesheet (mainqss. threewidget) self. rightwidget. setstylesheet (mainqss. threewidget) headlabel = qlabel (self. rightwidget) headlabel. setstylesheet (mainqss. headlabel) headlabel. setgeometry (25, 50, 80, 80) blogbutton = qpushbutton (u'my blog', self. rightwidget) blogbutton. setstylesheet (mainqss. textbutton) blogbutton. setgeometry (25,180,150, 30) blogwritebutton = qpushbutton (self. rightwidget) blogwritebutton. setstylesheet (mainqss. writebutton) blogwritebutton. setgeometry (180,182, 24, 24) notebutton = qpushbutton (U 'daily note', self. rightwidget) notebutton. setstylesheet (mainqss. textbutton) notebutton. setgeometry (25,220,150, 30) notewritebutton = qpushbutton (self. rightwidget) notewritebutton. setstylesheet (mainqss. writebutton) notewritebutton. setgeometry (180,222, 24, 24) taskbutton = qpushbutton (u'today's task', self. rightwidget) taskbutton. setstylesheet (mainqss. textbutton) taskbutton. setgeometry (25,260,150, 30) taskwritebutton = qpushbutton (self. rightwidget) taskwritebutton. setstylesheet (mainqss. writebutton) taskwritebutton. setgeometry (180,262, 24, 24) self. btnclose = qpushbutton (self. leftwidget) self. btnmini = qpushbutton (self. leftwidget) self. btnmax = qpushbutton (self. leftwidget) self. btnclose. setgeometry (5, 5, 24, 24) self. btnmini. setgeometry (64, 5, 24, 24) self. btnmax. setgeometry (35, 5, 24, 24) self. btnclose. setstylesheet (mainqss. btn_close) self. btnmini. setstylesheet (mainqss. btn_mini) self. btnmax. setstylesheet (mainqss. btn_max) self. leftlayout = qvboxlayout () self. centerlayout = qvboxlayout () self. rightlayout = qvboxlayout () self. leftlayout. addwidget (self. leftwidget) self. centerlayout. addwidget (self. centerwidget) self. rightlayout. addwidget (self. rightwidget) self. layout. addlayout (self. leftlayout) self. layout. addlayout (self. centerlayout) self. layout. addlayout (self. rightlayout) self. maxtonor = false self. layout. setcontentsmargins (0, 0, 0, 0) self. layout. setspacing (0) self. setlayout (self. layout) self. setwindowopacity (0.95) self. setsizepolicy (qsizepolicy. minimum, qsizepolicy. ignored) self. resize (1000,600) self. connect (self. btnclose, signal ("clicked ()"), qtgui. qapp, slot ("Quit ()") self. connect (self. btnmini, signal ("clicked ()"), self. showminimized) self. connect (self. btnmax, signal ("clicked ()"), self. showmaxnor) def showmaxnor (Self): If self. maxtonor: Self. shownormal () self. maxtonor = false else: Self. showmaximized () self. maxtonor = true def mousepressevent (self, event): If self. ismaximized (): return if event. button () = QT. leftbutton: Self. dragpos = event. globalpos ()-self. POs () event. accept () def mousemoveevent (self, qmouseevent): If self. ismaximized (): return if qmouseevent. buttons () and QT. leftbutton: Self. move (qmouseevent. globalpos ()-self. dragpos) qmouseevent. accept () def mousereleaseevent (self, qmouseevent): passif _ name _ = "_ main _": Import sys APP = qapplication (sys. argv) mu = mainui ()
Code 2
# -*- coding:utf8 -*-btn_close = ‘‘‘    QPushButton{        background-image: url(./img/close.png);        border-radius: 1px;    }    QPushButton:hover{        background-image: url(./img/closeHover.png);    }‘‘‘btn_mini = ‘‘‘    QPushButton{        background-image: url(./img/mini.png);        border-radius: 1px;    }    QPushButton:Hover{        background-image: url(./img/miniHover.png)    }‘‘‘btn_max = ‘‘‘    QPushButton{        background-image: url(./img/max.png);        border-radius: 1px;    }    QPushButton:Hover{        background-image: url(./img/maxHover.png)    }‘‘‘headLabel = ‘‘‘    QLabel{        background-color: #FFCCCC;        border-radius: 4px;        }‘‘‘textButton = ‘‘‘    QPushButton{        text-align: left;        color: white;        font: 20px "Times New Roman";        border-radius: 4px;        }    QPushButton:Hover{        color: #D6432D;         }‘‘‘writeButton = ‘‘‘    QPushButton{        background-image: url(./img/blogWrite.png);        border-radius: 4px;        }    QPushButton:Hover{        background-image: url(./img/blogWriteHover.png);        }‘‘‘threeWidget = ‘‘‘    QWidget{        background-color: #222222;        border-radius: 0px;        }‘‘‘


Pyqt basic learning practice 2 initial interface based on oschina Note Software

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.