исправлена неработающая функция парсинга docx. исправлены названия лабораторных работ.
This commit is contained in:
BIN
databases/autodrob.db
Normal file
BIN
databases/autodrob.db
Normal file
Binary file not shown.
56
gui/second_page.py
Normal file
56
gui/second_page.py
Normal file
@@ -0,0 +1,56 @@
|
||||
import wx
|
||||
|
||||
|
||||
class SecondPage(wx.Frame):
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"SecondPage", pos=wx.DefaultPosition,
|
||||
size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
|
||||
|
||||
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
|
||||
|
||||
fgSizer3 = wx.FlexGridSizer(0, 1, 0, 0)
|
||||
fgSizer3.SetFlexibleDirection(wx.BOTH)
|
||||
fgSizer3.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
|
||||
|
||||
self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"Выберите лабораторную работу", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
self.m_staticText5.Wrap(-1)
|
||||
fgSizer3.Add(self.m_staticText5, 0, wx.ALL, 5)
|
||||
|
||||
self.m_radioBtn9 = wx.RadioButton(self, wx.ID_ANY, u"Лабораторная работа № 1.", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
fgSizer3.Add(self.m_radioBtn9, 0, wx.ALL, 5)
|
||||
|
||||
self.m_radioBtn10 = wx.RadioButton(self, wx.ID_ANY, u"Лабораторная работа № 2.", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
fgSizer3.Add(self.m_radioBtn10, 0, wx.ALL, 5)
|
||||
|
||||
self.m_radioBtn11 = wx.RadioButton(self, wx.ID_ANY, u"Лабораторная работа № 3.", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
fgSizer3.Add(self.m_radioBtn11, 0, wx.ALL, 5)
|
||||
|
||||
self.m_radioBtn12 = wx.RadioButton(self, wx.ID_ANY, u"Лабораторная работа № 4.", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
fgSizer3.Add(self.m_radioBtn12, 0, wx.ALL, 5)
|
||||
|
||||
self.SetSizer(fgSizer3)
|
||||
self.Layout()
|
||||
|
||||
self.Centre(wx.BOTH)
|
||||
|
||||
# Connect Events
|
||||
self.m_radioBtn9.Bind(wx.EVT_LEFT_DCLICK, self.lab1)
|
||||
self.m_radioBtn10.Bind(wx.EVT_LEFT_DCLICK, self.lab1)
|
||||
|
||||
def __del__(self):
|
||||
pass
|
||||
|
||||
# Virtual event handlers, overide them in your derived class
|
||||
def lab1(self, event):
|
||||
from lab1 import lab1
|
||||
nex_page = lab1.MainFrame()
|
||||
nex_page.Show()
|
||||
|
||||
|
||||
app = wx.App(False)
|
||||
frame = SecondPage(None)
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
54
labs/lab1/lab1.py
Normal file
54
labs/lab1/lab1.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import wx
|
||||
from docx import Document
|
||||
|
||||
class Ttheory(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
wx.Panel.__init__(self, parent)
|
||||
|
||||
|
||||
|
||||
def get_theor(self):
|
||||
doc = Document('test1.docx')
|
||||
text_doc = doc.paragrapghs()
|
||||
self.doc_text.SetLabel(text_doc)
|
||||
|
||||
|
||||
class Labs(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
wx.Panel.__init__(self, parent)
|
||||
|
||||
class Results(wx.Panel):
|
||||
def __init__(self, parent):
|
||||
wx.Panel.__init__(self, parent)
|
||||
|
||||
|
||||
|
||||
class MainFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, title="Simple Notebook Example")
|
||||
|
||||
# Here we create a panel and a notebook on the panel
|
||||
p = wx.Panel(self)
|
||||
nb = wx.Notebook(p)
|
||||
|
||||
# create the page windows as children of the notebook
|
||||
page1 = Ttheory(nb)
|
||||
page2 = Labs(nb)
|
||||
page3 = Results(nb)
|
||||
|
||||
# add the pages to the notebook with the label to show on the tab
|
||||
nb.AddPage(page1, "Теория")
|
||||
nb.AddPage(page2, "Задание")
|
||||
nb.AddPage(page3, "Отчёт")
|
||||
|
||||
# finally, put the notebook in a sizer for the panel to manage
|
||||
# the layout
|
||||
sizer = wx.BoxSizer()
|
||||
sizer.Add(nb, 1, wx.EXPAND)
|
||||
p.SetSizer(sizer)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = wx.App()
|
||||
MainFrame().Show()
|
||||
app.MainLoop()
|
||||
14
main.py
14
main.py
@@ -11,7 +11,7 @@ class MainPage(wx.Frame):
|
||||
|
||||
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
|
||||
|
||||
sizer_all = wx.FlexGridSizer(2, 2, 0, 0)
|
||||
sizer_all = wx.FlexGridSizer(3, 2, 0, 0)
|
||||
sizer_all.SetFlexibleDirection(wx.BOTH)
|
||||
sizer_all.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
|
||||
|
||||
@@ -29,11 +29,23 @@ class MainPage(wx.Frame):
|
||||
self.pswd_txt = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, style=wx.TE_PASSWORD)
|
||||
sizer_all.Add(self.pswd_txt, 0, wx.ALL, 5)
|
||||
|
||||
|
||||
self.lgn_button = wx.Button(self, wx.ID_ANY, u"Войти")
|
||||
sizer_all.Add(self.lgn_button,0, wx.ALL, 5)
|
||||
|
||||
self.SetSizer(sizer_all)
|
||||
self.Layout()
|
||||
|
||||
self.Centre(wx.BOTH)
|
||||
|
||||
# Connect Events
|
||||
self.lgn_button.Bind(wx.EVT_BUTTON, self.login)
|
||||
|
||||
def login(self, event):
|
||||
from gui import second_page
|
||||
nxt_page = second_page.SecondPage(None)
|
||||
nxt_page.Show()
|
||||
nxt_page.Destroy()
|
||||
|
||||
app = wx.App(False)
|
||||
frame = MainPage(None)
|
||||
|
||||
22
service/scale image.py
Normal file
22
service/scale image.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import wx
|
||||
|
||||
def scale_bitmap(bitmap, width, height):
|
||||
image = wx.ImageFromBitmap(bitmap)
|
||||
image = image.Scale(width, height, wx.IMAGE_QUALITY_HIGH)
|
||||
result = wx.BitmapFromImage(image)
|
||||
return result
|
||||
|
||||
class Panel(wx.Panel):
|
||||
def __init__(self, parent, path):
|
||||
super(Panel, self).__init__(parent, -1)
|
||||
bitmap = wx.Bitmap(path)
|
||||
bitmap = scale_bitmap(bitmap, 300, 200)
|
||||
control = wx.StaticBitmap(self, -1, bitmap)
|
||||
control.SetPosition((10, 10))
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = wx.PySimpleApp()
|
||||
frame = wx.Frame(None, -1, 'Scaled Image')
|
||||
panel = Panel(frame, 'input.jpg')
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
Reference in New Issue
Block a user