예제 #1
0
    def __init__(self, t1):
        self.Text = "SpringNodes: Expandable Watch Window"
        self.BackColor = Color.FromArgb(40, 40, 40)
        self.ControlBox = False
        self.TopMost = True
        self.FormBorderStyle = FormBorderStyle.Sizable
        self.StartPosition = FormStartPosition.CenterScreen
        self.Resize += self.resize1
        self.text1 = None

        self.button1 = Button()
        self.button1.Text = 'Close'
        self.button1.Font = Font(IN[3], 10)
        self.button1.AutoSize = True
        self.button1.Width = 200
        self.button1.ForeColor = Color.FromArgb(234, 234, 234)
        self.button1.Click += self.save
        self.Controls.Add(self.button1)

        self.box1 = RichTextBox()
        self.box1.Multiline = True
        self.box1.Location = Point(5, 5)
        self.box1.Font = Font(IN[3], 12)
        self.box1.BackColor = Color.FromArgb(53, 53, 53)
        self.box1.ForeColor = Color.FromArgb(234, 234, 234)
        self.box1.DetectUrls = True
        self.box1.Text = t1
        self.Controls.Add(self.box1)
예제 #2
0
 def _initializeUserInterface(self):
     self.Size = Size(1600, 500)
     self.tlpMain.ColumnCount = len(self.columnNames)
     self.tlpMain.RowCount = 2
     self.tlpMain.Size = self.ClientRectangle.Size
     #create list titles
     for name in self.columnNames:
         lbl = Label()
         lbl.Text = name
         lbl.Font = Font("Microsoft Sans Serif", 12, FontStyle.Bold)
         lbl.Height = 50
         self.tlpMain.Controls.Add(lbl)
     #create lists
     for name in self.columnNames:
         lst = ListBox()
         lst.Name = name
         lst.Font = Font("Microsoft Sans Serif", 10)
         lst.Width = 135
         if name.ToLower() == 'attribute':
             lst.Width = 300
         if name.ToLower() == 'mode':
             lst.Width = 215
         lst.Height = self.ClientRectangle.Height - (lbl.Height * 2)
         self.tlpMain.Controls.Add(lst)
         self._populateLists(lst)
    def panel(self, x, y):

        self.panel = Panel()
        self.panel.Width = width - 15
        self.panel.Height = 800
        self.panel.Location = Point(x, y)
        self.panel.BorderStyle = BorderStyle.Fixed3D
        self.panel.BackColor = Color.White
        self.panel.AutoScroll = True

        j = 30

        for i in sorted_list:

            self.checkbox = CheckBox()
            self.checkbox.Text = i[0]
            self.checkbox.Location = Point(35, j)
            self.checkbox.Font = Font("Calibri Light", 10)

            self.checkbox_description = Label()
            self.checkbox_description.Text = i[1]
            self.checkbox_description.Location = Point(150, j + 2)
            self.checkbox_description.Width = 500

            self.checkbox_description.Font = Font("Calibri Light", 10)
            self.panel.Controls.Add(self.checkbox)
            self.panel.Controls.Add(self.checkbox_description)
            self.check_value.append(self.checkbox)

            j += 25

        return self.panel
예제 #4
0
    def header(self, x, y):

        style = FontStyle.Bold

        levels_selected = '-'
        objects_selected = '-'

        self.sublabel = Label()
        self.sublabel.Text = "Number of Levels Selected: " + str(
            levels_selected)
        self.sublabel.Location = Point(x + 40, y + 10)
        self.sublabel.Width = width - 200
        self.sublabel.Font = Font("Calibri Light", 12)
        #self.sublabel.ForeColor = Color.White
        #self.sublabel.ForeColor = Color.FromArgb(242, 112, 108)
        #self.sublabel.ForeColor = Color.Black

        self.sublabel_objects = Label()
        self.sublabel_objects.Text = "Number of Objects Current Selection: " + str(
            objects_selected)
        self.sublabel_objects.Location = Point(x + 40, y + 30)
        self.sublabel_objects.Width = width - 200
        self.sublabel_objects.Font = Font("Calibri Light", 12)
        #self.sublabel_objects.ForeColor = Color.White
        self.sublabel_objects.ForeColor = Color.FromArgb(242, 112, 108)
        self.sublabel_objects.ForeColor = Color.Black

        self.sublabel_no_selection = Label()
        self.sublabel_no_selection.Text = ""
        self.sublabel_no_selection.Location = Point(x + 40, y + 50)
        self.sublabel_no_selection.Width = width - 200
        self.sublabel_no_selection.Font = Font("Calibri Light", 12)
        #self.sublabel_no_selection.ForeColor = Color.White
        self.sublabel_no_selection.ForeColor = Color.FromArgb(242, 112, 108)
        self.sublabel_no_selection.ForeColor = Color.Black

        self.header = Panel()
        self.header.Width = width
        self.header.Height = 80
        self.header.AutoSize = True
        self.header.Font = Font("Calibri", 12)
        self.header.Location = Point(x, y)
        self.header.BackColor = Color.FromArgb(145, 201, 213)

        self.header.Controls.Add(self.sublabel)
        self.header.Controls.Add(self.sublabel_objects)
        self.header.Controls.Add(self.sublabel_no_selection)
        self.header.AutoScroll = True

        return self.header
예제 #5
0
    def header(self, x, y):
        
        style = FontStyle.Bold 

        assembly_codes_selected = '-'
        objects_selected = '-'
        
        self.sublabel = Label()
        self.sublabel.Text = "ProjectBasePoint (E/W, N/S, Elev)" 
        self.sublabel.Location = Point(x+40, y+10)
        self.sublabel.Width = width-200
        self.sublabel.Font = Font("Calibri Light", 12) 
        self.sublabel.Width = 400
        #self.sublabel.ForeColor = Color.White
        self.sublabel.ForeColor = Color.Black
        
        self.sublabel_objects = Label()
        self.sublabel_objects.Text = "SharedBasePoint (E/W, N/S, Elev)"
        self.sublabel_objects.Location = Point(x+40, y+30)
        self.sublabel_objects.Width = width-200
        self.sublabel_objects.Font = Font("Calibri Light", 12) 
        self.sublabel_objects.Width = 400
        #self.sublabel_objects.ForeColor = Color.White
        self.sublabel.ForeColor = Color.Black
        
        self.sublabel_no_selection = Label()
        self.sublabel_no_selection.Text = ""
        self.sublabel_no_selection.Location = Point(x+40, y+50)
        self.sublabel_no_selection.Width = width-200
        self.sublabel_no_selection.Font = Font("Calibri Light", 12, style)
        #self.sublabel_no_selection.ForeColor = Color.White 
        self.sublabel.ForeColor = Color.Black
        
        self.header = Panel()
        self.header.Width = width
        self.header.Height = 80
        self.header.AutoSize = True
        self.header.Font = Font("Calibri", 12) 
        self.header.Location = Point(x,y)
        #self.header.BackColor = Color.FromArgb(0, 0, 0)
        self.header.BackColor = Color.FromArgb(145, 201, 213)

        self.header.Controls.Add(self.sublabel)
        self.header.Controls.Add(self.sublabel_objects)
        self.header.Controls.Add(self.sublabel_no_selection)
        self.header.AutoScroll = True

    
        return self.header
    def __init__(self, cm1):
        self.Text = "SpringNodes: Filter By Selection"
        self.Width = 367
        self.BackColor = Color.FromArgb(40, 40, 40)
        self.output1 = []
        self.ControlBox = False
        self.TopMost = True
        self.FormBorderStyle = FormBorderStyle.FixedDialog
        self.StartPosition = FormStartPosition.CenterScreen

        self.label = Label()
        self.label.Text = cm1
        self.label.Location = Point(5, 5)
        self.label.ForeColor = Color.FromArgb(234, 234, 234)
        self.label.Font = Font("Calibri", 10)
        self.label.AutoSize = True
        self.Controls.Add(self.label)

        self.button1 = Button()
        self.button1.Text = 'Save Selection'
        self.button1.AutoSize = True
        self.button1.ForeColor = Color.FromArgb(234, 234, 234)
        self.button1.Font = Font("Calibri", 10)
        self.button1.Click += self.save
        self.Controls.Add(self.button1)

        self.button2 = Button()
        self.button2.Text = 'Uncheck All'
        self.button2.AutoSize = True
        self.button2.ForeColor = Color.FromArgb(234, 234, 234)
        self.button2.Font = Font("Calibri", 10)
        self.button2.Click += self.uncheckAll
        self.Controls.Add(self.button2)

        self.button3 = Button()
        self.button3.Text = 'Check All'
        self.button3.AutoSize = True
        self.button3.ForeColor = Color.FromArgb(234, 234, 234)
        self.button3.Font = Font("Calibri", 10)
        self.button3.Click += self.checkAll
        self.Controls.Add(self.button3)

        self.panel1 = Panel()
        self.panel1.Location = Point(5, 31)
        self.panel1.Width = 350
        self.panel1.BackColor = Color.FromArgb(53, 53, 53)
        self.panel1.ForeColor = Color.FromArgb(234, 234, 234)
        self.Controls.Add(self.panel1)
예제 #7
0
    def panel(self, x, y):

        self.panel = Panel()
        self.panel.Width = width - 15
        self.panel.Height = 800
        self.panel.Location = Point(x, y)
        self.panel.BorderStyle = BorderStyle.Fixed3D
        self.panel.BackColor = Color.White
        self.panel.AutoScroll = True

        j = 35

        for i in total_point_list:

            for x in i:
                self.label = Label()

                if (len(x)) > 1:
                    if x[1] is not None:
                        self.label.Text = str(x[0]) + "  " + str(x[1])
                        self.label.Location = Point(35, j)
                        self.label.Width = 400
                        self.label.Font = Font("Calibri Light", 12)
                        self.panel.Controls.Add(self.label)
                j += 25

        return self.panel
        def setupOKButtons(self):
            self.OKbuttonPanel = self.newPanel(0, 600)

            okButton = Button()
            okButton.Text = "OK"
            okButton.Location = Point(25, 50)
            self.AcceptButton = okButton
            okButton.Click += self.okClicked

            cancelButton = Button()
            cancelButton.Text = "Cancel"
            cancelButton.Location = Point(okButton.Left + okButton.Width + 10,
                                          okButton.Top)
            self.CancelButton = cancelButton
            cancelButton.Click += self.cancelClicked

            self.Status = Label()
            self.Status.Text = ""
            self.Status.Location = Point(200, 50)
            self.Status.AutoSize = True
            self.Status.Font = Font("Arial", 12, FontStyle.Bold)
            self.Status.ForeColor = Color.Black

            self.OKbuttonPanel.Controls.Add(okButton)
            self.OKbuttonPanel.Controls.Add(cancelButton)
            self.OKbuttonPanel.Controls.Add(self.Status)

            for CT in patient.Examinations:
                self.scancombo.Items.Add(CT.Name)
            try:
                self.scancombo.SelectedIndex = self.scancombo.FindStringExact(
                    "CT 1")
            except:
                self.scancombo.SelectedIndex = 0
예제 #9
0
    def __init__(self):
        self.Title="Timer"
        self.timer1=Timer()
        self.timer1.Interval=1000
        self.timer1.Tick+=self.timer1_tick
        label1=Label()
        label1.AutoSize=True
        label1.Location=Point(41,22)
        label1.Text="00:00:00"
        label1.Font=Font("MS UI Gothic",24.0,FontStyle.Regular)
        self.label1=label1
        self.Controls.Add(self.label1)

        clientwidth=255

        b1=Button()
        b1.Location=Point((clientwidth-b1.Width*2)/3,68)
        b1.Text="Click"
        b1.Click+=self.start_Click
        self.Controls.Add(b1)

        b2=Button()
        b2.Location=Point((clientwidth-b1.Width*2)*2/3+b1.Width,68)
        b2.Text="Stop"

        b2.Click+=self.stop_Click
        self.Controls.Add(b2)
        self.ClientSize=Size(clientwidth,103)
        self.Text="Stop Watch"
        self.StartPosition=FormStartPosition.CenterScreen
예제 #10
0
    def __init__(self):     #the __init__ method inside a class is its constructor

        self.Text = "AU London"      #text that appears in the GUI titlebar
        self.Icon = Icon.FromHandle(icon.GetHicon()) #takes a bitmap image and converts to a file that can be used as a Icon for the titlebar
        self.BackColor = Color.FromArgb(255, 255, 255) 
        
        self.WindowState = FormWindowState.Normal # set maximised minimised or normal size GUI
        self.CenterToScreen()   # centres GUI to the middle of your screen 
        self.BringToFront()     #brings the GUI to the front of all opens windows.
        self.Topmost = True    # true to display the GUI infront of any other active forms

        screenSize = Screen.GetWorkingArea(self)  #get the size of the computers main screen, as the form will scale differently to different sized screens
        self.Width = screenSize.Width / 4  #set the size of the form based on the size of the users screen. this helps to ensure consistant look across different res screens.
        self.Height = screenSize.Height / 4
        uiWidth = self.DisplayRectangle.Width    #get the size of the form to use to scale form elements
        uiHeight = self.DisplayRectangle.Height
    
        #self.FormBorderStyle = FormBorderStyle.FixedDialog      # fixed dialog stops the user from adjusting the form size. Recomended disabling this when testing to see if elements are in the wrong place.

        self.userOutput = userOutputDefaultStr  #create a container to store the output from the form
        self.runNextOutput =  False  #set these default values


#############-------------\-------------#############
        spacing = 10    #spacing size for GUI elements to form a consistent border
       
        # creates the text box for a info message
        userMessage = Label()   #label displays texts
        font = Font("Helvetica ", 10)
        userMessage.Text = message
        userMessage.Font = font
        userMessage.Location = Point(spacing, spacing)  #all location require a point object from system.Drawing to set the location.
        userMessage.Size = Size(uiWidth-(spacing*2),(uiHeight/4))   #size the control with the width of the GUI to ensure it scales with different screen
        self.Controls.Add(userMessage)       #this adds control element to the GUI
예제 #11
0
    def __init__(self, RB_print):
        self.RB_print = RB_print
        self.Text = 'RedBim'
        self.Name = 'RedBimPrinter'
        self.Height = 500
        self.Width = 700
        self.AutoScroll = True
        self.AutoScaleMode = AutoScaleMode.Font
        self.BackColor = Color.FromArgb(67, 67, 67)
        # self.BackgroundImage = Image.FromFile(os.path.join(STATIC_IMAGE, "bg.png"))
        # self.BackgroundImageLayout = ImageLayout.Center
        self.Icon = Icon(os.path.join(STATIC_IMAGE, "icon.ico"), 16, 16)
        self.StartPosition = FormStartPosition.CenterScreen

        self.label = Label()
        self.label.Anchor = (AnchorStyles.Top | AnchorStyles.Left
                             | AnchorStyles.Right)
        self.label.BackColor = Color.FromArgb(0, 0, 0, 0)
        self.label.Font = Font("ISOCPEUR", 12, FontStyle.Italic)
        self.label.ForeColor = Color.White
        self.label.Location = Point(0, 0)
        self.label.Name = "text"
        self.label.Dock = DockStyle.Top
        self.label.AutoSize = True
        self.Controls.Add(self.label)
        self.label.Click += self.add_to_clipboard
예제 #12
0
    def __init__(self, funct, *signature):
        '''
        funct : reference to function 
        (use __doc__ to give details or overide infomain.Text after creation)
        signature : optional, given with array ['str','str'] title, type
        '''
        self.infunction = funct
        self.signature = list(signature)
        self.parameters = []

        self.Text = Fconfig.formtitle
        self.Font = Font(Fconfig.basefont, Fconfig.sizefont)
        #SystemFonts.DialogFont

        self.infomain = Label()
        self.infomain.Parent = self
        self.infomain.Text = funct.__doc__
        self.infomain.Location = Point(Fconfig.margin, Fconfig.margin)
        self.infomain.Size = Size(Fconfig.smwidth, Fconfig.unitline)

        self.panel = Panel()
        self.panel.Parent = self
        self.panel.Location = Point(0, self.infomain.Bottom)
        self.panel.AutoSize = True

        self.panelparams = []
        ref = 0
        for i, param in enumerate(self.signature):
            p = Types.types(param[1], 'panel')(param)
            p.Parent = self.panel
            p.Location = Point(Fconfig.margin, ref)
            p.Width = Fconfig.smwidth
            self.panelparams.append(p)
            ref += p.Height
예제 #13
0
 def new_combobox(self):
     combobox = ComboBox()
     combobox.Font = Font("Lucida Console", 8)
     combobox.BackColor = self.color_window
     combobox.ForeColor = self.color_title
     combobox.Anchor = AnchorStyles.Top
     combobox.Size = Size(120, 21)
     return combobox
예제 #14
0
 def new_textbox(self):
     textbox = TextBox()
     textbox.Font = Font("Lucida Console", 8)
     textbox.BackColor = self.color_window
     textbox.ForeColor = self.color_title
     textbox.Anchor = AnchorStyles.Top
     textbox.TextAlign = HorizontalAlignment.Center
     return textbox
예제 #15
0
 def new_button(self):
     button = Button()
     button.BackColor = self.color_button
     button.Anchor = AnchorStyles.Top
     button.Text = "Button"
     button.Font = Font("Lucida Console", 10, FontStyle.Bold)
     button.Size = Size(92, 32)
     return button
 def add_check(self, text1, y1, b1):
     self.check1 = CheckBox()
     self.check1.Text = text1
     self.check1.Location = Point(5, y1)
     self.check1.AutoSize = True
     self.check1.Font = Font("Calibri", 10)
     self.check1.Checked = b1
     self.panel1.Controls.Add(self.check1)
예제 #17
0
 def doc_to_print_PrintPage(self, sender, event):
     # Insert code to render the page here.
     # This code will be called when the control is drawn.
     # The following code will render a simple
     # message on the document in the control.
     text = "In doc_to_print_PrintPage method."
     print_font = Font("Arial", 10, FontStyle.Bold)
     event.Graphics.DrawString(text, print_font, Brushes.Black, 10, 10)
예제 #18
0
    def ShowDialog(self, controller, title, text, default_input, exp_index):
        # set controller
        self.controller = controller

        # set exp index
        self.exp_index = exp_index

        # initialize exp name variable
        self.exp_name = None

        # initialize invalid name label
        self.invalid_name_label = None

        # create the form
        self.dialog_window = Form()
        self.dialog_window.AutoSize = True
        self.dialog_window.Width = 400
        self.dialog_window.MaximumSize = Size(400, 160)
        self.dialog_window.StartPosition = FormStartPosition.CenterScreen
        self.dialog_window.Text = title
        self.dialog_window.FormBorderStyle = FormBorderStyle.FixedSingle

        # create the main panel
        self.panel = FlowLayoutPanel()
        self.panel.Parent = self.dialog_window
        self.panel.BackColor = DIALOG_COLOR
        self.panel.Dock = DockStyle.Top
        self.panel.Padding = Padding(10, 10, 0, 10)
        self.panel.FlowDirection = FlowDirection.TopDown
        self.panel.WrapContents = False
        self.panel.AutoSize = True
        self.panel.Font = BODY_FONT

        # add the dialog text
        exp_name_label = Label()
        exp_name_label.Parent = self.panel
        exp_name_label.Text = text
        exp_name_label.Width = self.panel.Width
        exp_name_label.AutoSize = True
        exp_name_label.Margin = Padding(0, 5, 0, 0)

        # add the textbox
        self.exp_name_box = TextBox()
        self.exp_name_box.Text = default_input
        self.exp_name_box.Parent = self.panel
        self.exp_name_box.Width = self.panel.Width - 30
        self.exp_name_box.AutoSize = True
        self.exp_name_box.BackColor = BUTTON_PANEL_COLOR
        self.exp_name_box.Font = Font(BODY_FONT.FontFamily, 9)

        # add save button panel
        self.add_save_button_panel()

        # show the dialog
        self.dialog_window.ShowDialog()

        # return the exp name
        return self.exp_name
예제 #19
0
 def update_info(self, text):
     '''Display main info in the richtextbox
         arg : text as string
     '''
     self.top_info.Text = text
     self.top_info.SelectionStart = 0
     self.top_info.SelectionLength = len(self.top_info.Text.split('\n')[0])
     self.top_info.SelectionFont = Font(self.top_info.Font, FontStyle.Bold)
     self.top_info.SelectionLength = 0
예제 #20
0
    def header(self, x, y):
        
        style = FontStyle.Bold 

        assembly_codes_selected = '-'
        objects_selected = '-'
        
        self.sublabel = Label()
        self.sublabel.Text = "Number of Assembly Codes Selected: " + str(assembly_codes_selected)
        self.sublabel.Location = Point(x+40, y+10)
        self.sublabel.Width = width-200
        self.sublabel.Font = Font("Calibri Light", 12) 
        self.sublabel.ForeColor = Color.White
        
        self.sublabel_objects = Label()
        self.sublabel_objects.Text = "Number of Objects Current Selection: " + str(objects_selected)
        self.sublabel_objects.Location = Point(x+40, y+30)
        self.sublabel_objects.Width = width-200
        self.sublabel_objects.Font = Font("Calibri Light", 12) 
        self.sublabel_objects.ForeColor = Color.White
        
        self.sublabel_no_selection = Label()
        self.sublabel_no_selection.Text = ""
        self.sublabel_no_selection.Location = Point(x+40, y+50)
        self.sublabel_no_selection.Width = width-200
        self.sublabel_no_selection.Font = Font("Calibri Light", 12, style)
        self.sublabel_no_selection.ForeColor = Color.White 
        
        self.header = Panel()
        self.header.Width = width
        self.header.Height = 80
        self.header.AutoSize = True
        self.header.Font = Font("Calibri", 12) 
        self.header.Location = Point(x,y)
        self.header.BackColor = Color.FromArgb(0, 0, 0)

        self.header.Controls.Add(self.sublabel)
        self.header.Controls.Add(self.sublabel_objects)
        self.header.Controls.Add(self.sublabel_no_selection)
        self.header.AutoScroll = True

    
        return self.header
예제 #21
0
	def __init__(self, cm1):
		self.Text = "SpringNodes: Drag and Drop Reorder"
		self.Width = 367
		self.Height = n + 110
		self.ControlBox = False
		self.TopMost = True
		self.BackColor = Color.FromArgb(40,40,40)
		self.FormBorderStyle = FormBorderStyle.FixedDialog
		self.StartPosition = FormStartPosition.CenterScreen
		self.FormClosing += self.DisableForceClose
		self.SafeToClose = False
		
		self.label = Label()
		self.label.Text = cm1
		self.label.Location = Point(5, 5)
		self.label.ForeColor = Color.FromArgb(234,234,234)
		self.label.Font = Font("Calibri", 10)
		self.label.AutoSize = True
		self.Controls.Add(self.label)
		
		self.box1 = ListBox()
		self.box1.Location = Point(5,32)
		self.box1.Width = 350
		self.box1.Height = n
		self.box1.BackColor = Color.FromArgb(53,53,53)
		self.box1.ForeColor = Color.FromArgb(234,234,234)
		self.box1.Font = Font("Calibri", 11)
		self.box1.BorderStyle = BorderStyle.None
		self.box1.AllowDrop = True
		self.box1.MouseDown += self.Drag1
		self.box1.DragOver += self.Over1
		self.box1.DragDrop += self.Drop1
		self.Controls.Add(self.box1)

		self.button1 = Button()
		self.button1.Text = 'Save Order'
		self.button1.AutoSize = True
		self.button1.Width = 200
		self.button1.ForeColor = Color.FromArgb(234,234,234)
		self.button1.Font = Font("Calibri", 10)
		self.button1.Location = Point(80, n + 35)
		self.button1.Click += self.save
		self.Controls.Add(self.button1)
        def setupHeaderWindow(self):
            self.HeaderWindow = self.miniPanel(0, 0)     

            self.PatientIDHeader = Label()
            self.PatientIDHeader.Text = "Patient: " + patient.PatientName.replace('^', ', ')
            self.PatientIDHeader.Location = Point(25, 25)
            self.PatientIDHeader.Font = Font("Arial", 12, FontStyle.Bold)
            self.PatientIDHeader.AutoSize = True          

            self.HeaderWindow.Controls.Add(self.PatientIDHeader)
        def setupMessageWindow(self):
            self.MessageWindow = self.bigPanel(0, 0)

            self.Label1 = Label()
            self.Label1.Text = input
            self.Label1.Location = Point(25, 25)
            self.Label1.Font = Font("Arial", 10)
            self.Label1.AutoSize = True
            
            self.MessageWindow.Controls.Add(self.Label1)
예제 #24
0
 def __drawFolderThumbnail(self, parent):
     size = ThumbnailSize
     # create new image
     newImage = Bitmap(size, size)
     g = Graphics.FromImage(newImage)
     g.InterpolationMode = InterpolationMode.HighQualityBicubic
     # draw background
     if parent: bc = ParentFolderColor
     else: bc = ChildFolderColor
     b = LinearGradientBrush(Point(0, 0), Point(size, size), bc,
                             Color.GhostWhite)
     g.FillRectangle(b, 0, 0, size, size)
     b.Dispose()
     g.DrawRectangle(Pens.LightGray, 0, 0, size - 1, size - 1)
     # draw up to 4 subitems
     folderItems = self.GetFirstFolderItems(4)
     delta = 10
     side = (size - 3 * delta) / 2 - 1
     rects = (Rectangle(delta + 3, delta + 12, side, side),
              Rectangle(size / 2 + delta / 2 - 3, delta + 12, side, side),
              Rectangle(delta + 3, size / 2 + delta / 2 + 6, side, side),
              Rectangle(size / 2 + delta / 2 - 3, size / 2 + delta / 2 + 6,
                        side, side))
     for rect, item in zip(rects, folderItems):
         subImage = Bitmap.FromStream(MemoryStream(item.thumbnail()), False)
         g.DrawImage(subImage, rect)
         subImage.Dispose()
     for rect in rects:
         g.DrawRectangle(Pens.LightGray, rect)
     # draw folder name
     if parent: name = '[..]'
     else: name = Path.GetFileName(self.path)
     f = Font('Arial', 10)
     g.DrawString(name, f, Brushes.Black,
                  RectangleF(2, 2, size - 2, size - 2))
     f.Dispose()
     # get the bytes of the image
     imageBytes = BitmapToBytes(newImage)
     # cleanup
     g.Dispose()
     newImage.Dispose()
     return imageBytes
예제 #25
0
class ShowTextFile(Form):
  
    def __init__(self, fName):
      
          fContent=""
          try:
             with open(fName, 'r') as f:
              for line in f: 
                fContent += line + "\r\n"
                #print line
              f.close()  
          except Exception,e :
            fContent="No content "
         
          self.Text = "SolverStudio pyCMPL Viewer: "+fName
          self.FormBorderStyle = FormBorderStyle.Sizable # SizableToolWindow # FixedDialog    
          self.Height=500
          self.Width = 600
          
          self.Content = TextBox()
          self.Content.Text=fContent
          self.Content.ReadOnly=True
          self.Content.SelectionStart = 0
          
          self.Content.Multiline = True
          self.Content.WordWrap = False
          self.Content.ScrollBars = ScrollBars.Both
          self.Content.Dock = DockStyle.Fill
          self.Content.Font=Font("Courier New",10)
          
          
          self.bOK=Button()
          self.bOK.Text = "OK"
          self.bOK.Anchor =  (AnchorStyles.Bottom | AnchorStyles.Right);
          # self.bOK.Dock = DockStyle.Right
          # self.bOK.Width = 75 AJM: Go with the default height/width to be more Windows-like
          # self.bOK.Height = 25
          self.bOK.Click += self.OK
          
          self.AcceptButton = self.bOK
          
          self.buttonPanel=Panel()
          self.buttonPanel.Dock=DockStyle.Bottom
          self.buttonPanel.Height=35
          self.buttonPanel.Controls.Add(self.bOK)
          
          self.bOK.Left = self.buttonPanel.Width - self.bOK.Width - 20 # AJM: Position button nicely
          self.bOK.Top = 7 # AJM: Position button nicely
         
          self.Controls.Add(self.Content)
          self.Controls.Add(self.buttonPanel)
        
          self.CenterToScreen()
    def __build_prevbutton(self):
        ''' Builds and returns the 'previous' button for this panel. '''

        button = Button()
        button.Location = Point(2, 332)
        button.Size = Size(20, 24)
        button.Text = '<'
        button.Font = Font(button.Font, FontStyle.Bold)
        button.UseVisualStyleBackColor = True
        button.Click += self.__button_click_fired
        # note: this button's visibility is manipulated by __update
        return button
예제 #27
0
    def add_TTL_param_to_window(self, name, label_text):
        # add param label
        add_param_label(label_text + ':', self.TTL_param_panel)

        # add param textbox
        self.TTL_param_textboxes[name] = TextBox()
        self.TTL_param_textboxes[name].Parent = self.TTL_param_panel
        self.TTL_param_textboxes[name].Text = str(self.TTL_params[name])
        self.TTL_param_textboxes[name].Width = 150
        self.TTL_param_textboxes[name].BackColor = TEXTBOX_COLOR
        self.TTL_param_textboxes[name].AutoSize = True
        self.TTL_param_textboxes[name].Font = Font(BODY_FONT.FontFamily, 18)
예제 #28
0
def make_table(name, autosize=True):
    table = DataGridView()
    # allow user
    table.AllowUserToResizeColumns = False
    table.AllowUserToResizeRows = False
    table.AllowUserToAddRows = False
    table.AllowUserToDeleteRows = False
    # auto size
    table.AutoSize = autosize
    table.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
    table.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
    # back
    table.BackColor = Color.White
    table.BackgroundColor = Color.White
    # border
    table.BorderStyle = BorderStyle.None
    table.CellBorderStyle = DataGridViewCellBorderStyle.Single
    # column header
    table.ColumnHeadersVisible = True
    table.ColumnHeadersDefaultCellStyle.BackColor = Color.FromArgb(
        238, 238, 238)
    table.ColumnHeadersDefaultCellStyle.Font = Font(table.Font, FontStyle.Bold)
    table.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
    table.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
    # default cell
    table.DefaultCellStyle.SelectionBackColor = Color.White
    table.DefaultCellStyle.SelectionForeColor = Color.Black
    # dock
    if autosize:
        table.Dock = System.Windows.Forms.DockStyle.Fill
    # enable
    table.EnableHeadersVisualStyles = False
    # grid
    table.GridColor = Color.FromArgb(200, 200, 200)
    # select
    table.MultiSelect = False
    # name
    table.Name = name
    # row header
    table.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single
    table.RowHeadersDefaultCellStyle.BackColor = Color.FromArgb(240, 240, 240)
    table.RowHeadersDefaultCellStyle.ForeColor = Color.Empty
    table.RowHeadersDefaultCellStyle.SelectionBackColor = Color.Empty
    table.RowHeadersDefaultCellStyle.SelectionForeColor = Color.Empty
    table.RowHeadersVisible = False
    # scrolling
    # table.ScrollBars = ScrollBars.None
    # select
    table.SelectionMode = DataGridViewSelectionMode.FullRowSelect
    # top left header
    table.TopLeftHeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
    return table
예제 #29
0
    def showBox(self):
        '''
        set the remaining box controls and launch
        '''
        self.buttonpanel = Panel()
        self.buttonpanel.Parent = self
        self.buttonpanel.Location = Point(0, self.panel.Bottom)
        self.buttonpanel.Size = Size(Fconfig.smwidth, 2 * Fconfig.unitline)
        self.buttonpanel.Dock = DockStyle.Bottom

        self.warning = Label()
        self.warning.Parent = self.buttonpanel
        self.warning.Location = Point(Fconfig.margin, 0)
        self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline)
        self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont,
                                 FontStyle.Bold)
        self.warning.ForeColor = Color.Coral
        self.warning.TextAlign = ContentAlignment.MiddleCenter

        okay = Button()
        okay.Parent = self.buttonpanel
        okay.Text = Fconfig.buttonOK
        okay.Location = Point(50, Fconfig.unitline)
        okay.Width = 140
        okay.Click += self.onValidate
        okay.Anchor = AnchorStyles.Right

        cancel = Button()
        cancel.Text = Fconfig.buttonCANCEL
        cancel.Parent = self.buttonpanel
        cancel.Location = Point(okay.Right, Fconfig.unitline)
        cancel.Click += self.onCancel
        cancel.Anchor = AnchorStyles.Right

        self.Width = Fconfig.width
        self.Height = self.panel.Bottom + 105
        self.CenterToScreen()

        ModeDBG.say('\npanel top :{0}, bottom :{1}'.format(
            self.panel.Top, self.panel.Bottom))
        ModeDBG.say('\n\nPanel loaded with {0} items\n'.format(
            len(self.panelparams)))

        # Display the form
        try:
            if Application.MessageLoop:
                TaskDialog.Show('UserForm', 'Another window is running...')
            else:
                Application.Run(self)

        except:
            TaskDialog.Show('UserForm', 'Loading failed...')
예제 #30
0
 def __init__(self, RB_print):
     self.RB_print = RB_print
     self.Text = 'RedBim'
     self.Name = 'RedBimPrinter'
     self.Height = 500
     self.Width = 700
     self.label = TextBox()
     self.label.Dock = DockStyle.Fill
     self.label.Multiline = True
     self.label.ReadOnly = True
     self.label.Font = Font('Arial', 12)
     self.label.ScrollBars = ScrollBars.Vertical
     self.Controls.Add(self.label)