Exemple #1
0
    def __init__(self):

        self.holdPanel = JPanel()
        self.topPanel = JPanel()
        self.bottomPanel = JPanel()

        self.holdPanel.setBackground(Color.decode('#dddee6'))
        self.topPanel.setBackground(Color.decode('#dddee6'))
        self.bottomPanel.setBackground(Color.decode('#dddee6'))

        self.topPanel.setPreferredSize(Dimension(300, 30))

        self.regBar = JProgressBar()
        self.gatePassBar = JProgressBar()
        self.regLabel = JLabel('Register : ')
        self.gatepassLabel = JLabel('          Gate Pass : '******'')
        self.gatePercentlabel = JLabel('')

        self.refreshButton = JButton('Refresh',
                                     actionPerformed=self.updateProgress)

        self.regBar.setMinimum(0)
        self.regBar.setMaximum(100)
        self.regBar.setStringPainted(True)

        self.gatePassBar.setMinimum(0)
        self.gatePassBar.setMaximum(100)
        self.gatePassBar.setStringPainted(True)

        self.setLayout(BorderLayout())

        self.updateProgress(None)
Exemple #2
0
    def initMenuPanel(self):

        buttonPanel = JPanel(GridLayout(10, 1, 5, 5))
        addAdmin = JButton('Add Admin', actionPerformed=self.addAdminPanel)
        deleteAdmin = JButton('Delete Admin',
                              actionPerformed=self.addDeleteAdminPanel)
        regUser = JButton('Register User', actionPerformed=self.addRegPanel)
        deRegUser = JButton('De-Register User',
                            actionPerformed=self.addDeregisterPanel)
        emgBypass = JButton('Emergency Bypass',
                            actionPerformed=self.addEmergencyPanel)
        viewLogs = JButton('View Logs', actionPerformed=self.addViewLogsPanel)
        login = JButton('Login', actionPerformed=self.addLoginForm)
        logout = JButton('Logout', actionPerformed=self.logout)
        quit = JButton('Quit', actionPerformed=dialog.quitApplicationMsg)
        about = JButton('About', actionPerformed=self.addDefaultPanel)

        # buttonPanel.setPreferredSize(Dimension(200,350))
        # self.setPreferredSize(Dimension(250,250))

        #add widgets
        buttonPanel.setBackground(Color.decode('#3d4968'))
        buttonPanel.add(addAdmin)
        buttonPanel.add(deleteAdmin)
        buttonPanel.add(regUser)
        buttonPanel.add(deRegUser)
        buttonPanel.add(emgBypass)
        buttonPanel.add(viewLogs)
        buttonPanel.add(login)
        buttonPanel.add(logout)
        buttonPanel.add(quit)
        buttonPanel.add(about)
        self.menuPanel.add(buttonPanel)
Exemple #3
0
def getcolor(style, alpha=None):
    if style is None:
        return None
        
    if isinstance(style, Color):
        c = style
        if not alpha is None:
            alpha = (int)(alpha * 255)
            c = Color(c.getRed(), c.getGreen(), c.getBlue(), alpha)
        return c
        
    c = Color.black
    if isinstance(style, str):
        if style == 'red' or style == 'r':
            c = Color.red
        elif style == 'black' or style == 'k':
            c = Color.black
        elif style == 'blue' or style == 'b':
            c = Color.blue
        elif style == 'green' or style == 'g':
            c = Color.green
        elif style == 'white' or style == 'w':
            c = Color.white
        elif style == 'yellow' or style == 'y':
            c = Color.yellow
        elif style == 'gray':
            c = Color.gray
        elif style == 'lightgray':
            c = Color.lightGray
        elif style == 'cyan' or style == 'c':
            c = Color.cyan
        elif style == 'magenta' or style == 'm':
            c = Color.magenta
        elif style == 'pink' or style == 'p':
            c = Color.pink
        else:
            try:
                c = Color.decode(style)
            except:
                c = None
                print('Not a valid color: {}'.format(style))
                return c
    elif isinstance(style, (tuple, list)):
        if len(style) == 3:
            c = Color(style[0], style[1], style[2])
        else:
            c = Color(style[0], style[1], style[2], style[3])
    
    if not alpha is None:
        alpha = (int)(alpha * 255)
        c = Color(c.getRed(), c.getGreen(), c.getBlue(), alpha)
    
    return c
Exemple #4
0
    def initComponents(self):

        self.menuPanel = JPanel()
        self.initMenuPanel()
        self.currentPanel = AboutPanel()

        # colors for testing
        # self.menuPanel.setBackground(Color.PINK)
        self.menuPanel.setBackground(Color.decode('#3d4968'))
        self.setBackground(Color.YELLOW)

        # self.setLayout(GridLayout(1,2))
        self.setLayout(BorderLayout())
        self.add(self.menuPanel, BorderLayout.LINE_START)
Exemple #5
0
	def  initGui(self):

		self.topPanel = TopPanel()
		centerPanel = CenterPanel()
		bottomPanel = BottomPanel()
		
		self.topPanel.setPreferredSize(Dimension(300,50))
		centerPanel.setPreferredSize(Dimension(600,200))
		bottomPanel.setPreferredSize(Dimension(300,100))

		# colors for testing
		# topPanel.setBackground(Color.RED)
		self.topPanel.setBackground(Color.decode('#202941'))
		# centerPanel.setBackground(Color.GREEN)
		# centerPanel.setBackground(Color.GREEN)
		bottomPanel.setBackground(Color.decode('#fddee6'))





		self.setLayout(BorderLayout())

		#add panels
		self.add(self.topPanel,BorderLayout.PAGE_START)
		self.add(centerPanel,BorderLayout.CENTER)
		self.add(bottomPanel,BorderLayout.PAGE_END)

		self.setTitle('Smart Parking System')
		icon = ImageIcon('sp_transparent.png')
		self.setIconImage(icon.getImage())
		self.pack()
		self.setSize(800,700)
		self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
		self.setLocationRelativeTo(None)
		self.setVisible(True)
		self.topPanel.refresh()

# runLayout(ForceAtlas2, iters = 3000)

#num_clusters = 10
#cluster_numbers = [1, 3, 4, 5]
# cluster_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
cluster_numbers = []
for node in list(g.nodes):
	cluster_num = int(getattr(node, cluster_type))
	if (cluster_num not in cluster_numbers):
	
		cluster_numbers.append(cluster_num)
cluster_numbers.sort()
print cluster_numbers
num_clusters = len(cluster_numbers)

colour_list = Spectral[num_clusters]

for i in range(num_clusters):
#for i in range(num_clusters):
	mySubGraph = g.filter(eval(cluster_type) == cluster_numbers[i])
	print i
	print cluster_numbers[i]
	print colour_list[i]
	for node in list(mySubGraph.nodes):
		node.color = Color.decode(colour_list[i])
		
# print rgb
# node.color = Color(rgb[0], rgb[1], rgb[2])
# rgb = [int(s) for s in re.split('[,]|[(]|[)]', colour_list[i]) if s.isdigit()]
Exemple #7
0
 def refresh(self):
     admin = client.get_current_admin()
     self.login.setText('          Login : '******'#ffffff'))
     self.add(self.login, BorderLayout.LINE_START)
     self.validate()
Exemple #8
0
def color(*args):
    from java.awt import Color
    if (len(args) == 1): return Color.decode(args[0])
    else:
       c = args
       return Color(c[0], c[1], c[2])